Ticket #23841: 23841.2.diff
| File 23841.2.diff, 2.2 KB (added by , 13 years ago) |
|---|
-
wp-content/themes/twentythirteen/js/functions.js
5 5 */ 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 11 18 * higher than the rest of the page, to help the footer always … … 16 23 secondary = ( 0 == sidebar.length ) ? -40 : sidebar.height(), 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 }, 22 29 … … 36 43 if ( body.is( '.sidebar' ) ) 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 57 59 html.removeClass( 'navbar-fixed' ); … … 97 99 * 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 103 105 if ( element ) {