Make WordPress Core

Changeset 53247


Ignore:
Timestamp:
04/24/2022 09:01:09 PM (2 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/js/functions.js

    r52285 r53247  
    100100            windowHeight = $window.height(),
    101101            sidebarHeight = $sidebar.height(),
    102             bodyHeight = $body.height();
     102            pageHeight = $( '#page' ).height();
    103103
    104         if( 955 < $window.width() && bodyHeight > sidebarHeight && ( windowPos + windowHeight ) >= sidebarHeight ) {
     104        if ( 955 < $window.width() && pageHeight > sidebarHeight && ( windowPos + windowHeight ) >= sidebarHeight ) {
    105105            $sidebar.css({
    106106                position: 'fixed',
Note: See TracChangeset for help on using the changeset viewer.