Twenty Fifteen: correcting odd scrolling and jumping in IE and no-scroll with window resize.

Props iamtakashi, ocean90, fixes #30632, #30645.




git-svn-id: https://develop.svn.wordpress.org/trunk@30808 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ian Stewart 2014-12-10 23:01:03 +00:00
parent 9855b67c67
commit 3b84f1d6d8

View File

@ -6,9 +6,9 @@
*/
( function( $ ) {
var $body, $window, $document, $sidebar, adminbarOffset, top = false,
var $body, $window, $sidebar, adminbarOffset, top = false,
bottom = false, windowWidth, windowHeight, lastWindowPos = 0,
topOffset = 0, documentHeight, sidebarHeight, resizeTimer;
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( '<button class="dropdown-toggle" aria-expanded="false">' + screenReaderText.expand + '</button>' );
@ -54,7 +54,7 @@
function resize() {
windowWidth = $window.width();
windowHeight = $window.height();
documentHeight = $document.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,9 +106,8 @@
}
$( document ).ready( function() {
$body = $( 'body' );
$body = $( document.body );
$window = $( window );
$document = $( document );
$sidebar = $( '#sidebar' ).first();
adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;