Changeset 23965
- Timestamp:
- 04/11/2013 04:11:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentythirteen/js/functions.js
r23891 r23965 6 6 7 7 ( function( $ ) { 8 var twentyThirteen = { 8 var html = $( 'html' ), 9 body = $( 'body' ), 10 navbar = $( '#navbar' ), 11 _window = $( window ), 12 navbarOffset = -1, 13 toolbarOffset = body.is( '.admin-bar' ) ? 28 : 0, 14 15 twentyThirteen = { 9 16 /** 10 17 * Adds a top margin to the footer if the sidebar widget area is … … 17 24 margin = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary; 18 25 19 if ( margin > 0 && window.innerWidth> 999 )26 if ( margin > 0 && _window.innerWidth() > 999 ) 20 27 $( '#colophon' ).css( 'margin-top', margin + 'px' ); 21 28 }, … … 37 44 twentyThirteen.adjustFooter(); 38 45 } ); 39 $( window ).on( 'hashchange', twentyThirteen.adjustAnchor );46 _window.on( 'hashchange', twentyThirteen.adjustAnchor ); 40 47 41 48 /** 42 49 * Displays the fixed navbar based on screen position. 43 50 */ 44 var html = $( 'html' ), 45 body = $( 'body' ), 46 navbar = $( '#navbar' ), 47 navbarOffset = -1, 48 toolbarOffset = body.is( '.admin-bar' ) ? 28 : 0; 49 50 $( window ).scroll( function() { 51 _window.scroll( function() { 52 var scrollOffset = ( typeof window.scrollY === 'undefined' ) ? document.documentElement.scrollTop : window.scrollY; 51 53 if ( navbarOffset < 0 ) 52 54 navbarOffset = navbar.offset().top - toolbarOffset; 53 55 54 if ( window.scrollY >= navbarOffset && 644 < window.innerWidth)56 if ( scrollOffset >= navbarOffset && _window.innerWidth() > 644 ) 55 57 html.addClass( 'navbar-fixed' ); 56 58 else … … 98 100 * @link http://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/ 99 101 */ 100 $( window ).on( 'hashchange', function() {102 _window.on( 'hashchange', function() { 101 103 var element = $( location.hash ); 102 104
Note: See TracChangeset
for help on using the changeset viewer.