From d3adc020513d8e9d5dc1d54dfa64915a4f4b0558 Mon Sep 17 00:00:00 2001 From: Ian Stewart Date: Wed, 10 Dec 2014 23:02:23 +0000 Subject: [PATCH] Twenty Fifteen: correcting odd scrolling and jumping in IE and no-scroll with window resize. Props iamtakashi, ocean90, fixes #30632, #30645. Built from https://develop.svn.wordpress.org/trunk@30808 git-svn-id: http://core.svn.wordpress.org/trunk@30798 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/twentyfifteen/js/functions.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/wp-content/themes/twentyfifteen/js/functions.js b/wp-content/themes/twentyfifteen/js/functions.js index 9415ba556d..c4ff8d7683 100644 --- a/wp-content/themes/twentyfifteen/js/functions.js +++ b/wp-content/themes/twentyfifteen/js/functions.js @@ -6,9 +6,9 @@ */ ( function( $ ) { - var $body, $window, $document, $sidebar, adminbarOffset, top = false, - bottom = false, windowWidth, windowHeight, lastWindowPos = 0, - topOffset = 0, documentHeight, sidebarHeight, resizeTimer; + var $body, $window, $sidebar, adminbarOffset, top = false, + bottom = false, windowWidth, windowHeight, lastWindowPos = 0, + topOffset = 0, bodyHeight, sidebarHeight, resizeTimer; // Add dropdown toggle that display child menu items. $( '.main-navigation .page_item_has_children > a, .main-navigation .menu-item-has-children > a' ).after( '' ); @@ -52,9 +52,9 @@ // Sidebar scrolling. function resize() { - windowWidth = $window.width(); - windowHeight = $window.height(); - documentHeight = $document.height(); + windowWidth = $window.width(); + windowHeight = $window.height(); + bodyHeight = $body.height(); sidebarHeight = $sidebar.height(); if ( 955 > windowWidth ) { @@ -66,7 +66,7 @@ function scroll() { var windowPos = $window.scrollTop(); - if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < documentHeight ) { + if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < bodyHeight ) { if ( sidebarHeight + adminbarOffset > windowHeight ) { if ( windowPos > lastWindowPos ) { if ( top ) { @@ -106,10 +106,9 @@ } $( document ).ready( function() { - $body = $( 'body' ); + $body = $( document.body ); $window = $( window ); - $document = $( document ); - $sidebar = $( '#sidebar' ).first(); + $sidebar = $( '#sidebar' ).first(); adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; $window