Changeset 26059
- Timestamp:
- 11/09/2013 03:31:29 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/js/functions.js
r25999 r26059 60 60 61 61 /* 62 * Fixed navbar. 62 * Fixed header for large screen. 63 * If the header becomes more than 48px tall, unfix the header. 63 64 * 64 65 * The callback on the scroll event is only added if there is a header 65 66 * image and we are not on mobile. 66 67 */ 67 if ( body.is( '.header-image' ) && _window.width() > 781 ) { 68 var toolbarOffset = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0, 69 mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset; 68 if ( _window.width() > 781 ) { 69 var mastheadHeight = $( '#masthead' ).height(); 70 70 71 _window.on( 'scroll.twentyfourteen', function() { 72 if ( window.scrollY > mastheadOffset ) { 73 body.addClass( 'masthead-fixed' ); 74 } else { 75 body.removeClass( 'masthead-fixed' ); 76 } 77 } ); 71 if ( mastheadHeight > 48 ) { 72 body.removeClass( 'masthead-fixed' ); 73 } 74 75 if ( body.is( '.header-image' ) ) { 76 var toolbarOffset = body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0, 77 mastheadOffset = $( '#masthead' ).offset().top - toolbarOffset; 78 79 _window.on( 'scroll.twentyfourteen', function() { 80 if ( ( window.scrollY > mastheadOffset ) && ( mastheadHeight < 49 ) ) { 81 body.addClass( 'masthead-fixed' ); 82 } else { 83 body.removeClass( 'masthead-fixed' ); 84 } 85 } ); 86 } 78 87 } 79 88
Note: See TracChangeset
for help on using the changeset viewer.