mirror of
git://develop.git.wordpress.org/
synced 2025-01-19 13:47:02 +01:00
Twenty Fourteen: when header is more than 48px tall (like two lines of menu items), unfix the header so it doesn't overlap the page content. Props iamtakashi, fixes #25554.
git-svn-id: https://develop.svn.wordpress.org/trunk@26059 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f5f951ab3c
commit
14ce5221ae
@ -59,23 +59,32 @@
|
||||
} );
|
||||
|
||||
/*
|
||||
* Fixed navbar.
|
||||
* Fixed header for large screen.
|
||||
* If the header becomes more than 48px tall, unfix the header.
|
||||
*
|
||||
* The callback on the scroll event is only added if there is a header
|
||||
* image and we are not on mobile.
|
||||
*/
|
||||
if ( body.is( '.header-image' ) && _window.width() > 781 ) {
|
||||
if ( _window.width() > 781 ) {
|
||||
var mastheadHeight = $( '#masthead' ).height();
|
||||
|
||||
if ( mastheadHeight > 48 ) {
|
||||
body.removeClass( 'masthead-fixed' );
|
||||
}
|
||||
|
||||
if ( body.is( '.header-image' ) ) {
|
||||
var toolbarOffset = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0,
|
||||
mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset;
|
||||
|
||||
_window.on( 'scroll.twentyfourteen', function() {
|
||||
if ( window.scrollY > mastheadOffset ) {
|
||||
if ( ( window.scrollY > mastheadOffset ) && ( mastheadHeight < 49 ) ) {
|
||||
body.addClass( 'masthead-fixed' );
|
||||
} else {
|
||||
body.removeClass( 'masthead-fixed' );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
// Focus styles for menus.
|
||||
$( '.primary-navigation, .secondary-navigation' ).find( 'a' ).on( 'focus.twentyfourteen blur.twentyfourteen', function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user