From f1235f2cba73cc2c0f02600fe982a24d30531452 Mon Sep 17 00:00:00 2001 From: Jb Audras Date: Sun, 24 Apr 2022 21:01:09 +0000 Subject: [PATCH] Twenty Fifteen: Use `#page` height instead of `body` height in sidebar scroll calculation. This changeset replaces `bodyHeight = $body.height();` with `bodyHeight = $('#page).height();`. It fixes a JS issue in some specific context, when there is content generated right before the closing `body` tag. For example, this happens when the HTML content is added using the `wp_footer` filter. Props stephenharris, sabernhardt, audrasjb. Fixes #40492. git-svn-id: https://develop.svn.wordpress.org/trunk@53247 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyfifteen/js/functions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentyfifteen/js/functions.js b/src/wp-content/themes/twentyfifteen/js/functions.js index 1124de0d4d..ba102a0cb4 100644 --- a/src/wp-content/themes/twentyfifteen/js/functions.js +++ b/src/wp-content/themes/twentyfifteen/js/functions.js @@ -99,9 +99,9 @@ var windowPos = $window.scrollTop(), windowHeight = $window.height(), sidebarHeight = $sidebar.height(), - bodyHeight = $body.height(); + pageHeight = $( '#page' ).height(); - if( 955 < $window.width() && bodyHeight > sidebarHeight && ( windowPos + windowHeight ) >= sidebarHeight ) { + if ( 955 < $window.width() && pageHeight > sidebarHeight && ( windowPos + windowHeight ) >= sidebarHeight ) { $sidebar.css({ position: 'fixed', bottom: sidebarHeight > windowHeight ? 0 : 'auto'