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.

Built from https://develop.svn.wordpress.org/trunk@53247


git-svn-id: http://core.svn.wordpress.org/trunk@52836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-04-24 21:03:10 +00:00
parent 8ca3012db9
commit 9564a68697
2 changed files with 3 additions and 3 deletions

View File

@ -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'

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta2-53246';
$wp_version = '6.0-beta2-53247';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.