Ticket #30632: 30632.2.diff
File 30632.2.diff, 2.0 KB (added by , 8 years ago) |
---|
-
src/wp-content/themes/twentyfifteen/js/functions.js
6 6 */ 7 7 8 8 ( function( $ ) { 9 var $body, $window, $ document, $sidebar, adminbarOffset, top = false,10 11 topOffset = 0, documentHeight, sidebarHeight, resizeTimer;9 var $body, $window, $sidebar, adminbarOffset, top = false, 10 bottom = false, windowWidth, windowHeight, lastWindowPos = 0, 11 topOffset = 0, bodyHeight, sidebarHeight, resizeTimer; 12 12 13 13 // Add dropdown toggle that display child menu items. 14 14 $( '.main-navigation .page_item_has_children > a, .main-navigation .menu-item-has-children > a' ).after( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' ); … … 52 52 53 53 // Sidebar scrolling. 54 54 function resize() { 55 windowWidth = $window.width();56 windowHeight = $window.height();57 documentHeight = $document.height();55 windowWidth = $window.width(); 56 windowHeight = $window.height(); 57 bodyHeight = $body.height(); 58 58 sidebarHeight = $sidebar.height(); 59 59 60 60 if ( 955 > windowWidth ) { … … 66 66 function scroll() { 67 67 var windowPos = $window.scrollTop(); 68 68 69 if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < documentHeight ) {69 if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < bodyHeight ) { 70 70 if ( sidebarHeight + adminbarOffset > windowHeight ) { 71 71 if ( windowPos > lastWindowPos ) { 72 72 if ( top ) { … … 106 106 } 107 107 108 108 $( document ).ready( function() { 109 $body = $( 'body');109 $body = $( document.body ); 110 110 $window = $( window ); 111 $document = $( document ); 112 $sidebar = $( '#sidebar' ).first(); 111 $sidebar = $( '#sidebar' ).first(); 113 112 adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; 114 113 115 114 $window