Make WordPress Core

Ticket #30632: 30632.diff

File 30632.diff, 2.0 KB (added by iamtakashi, 9 years ago)
  • src/wp-content/themes/twentyfifteen/js/functions.js

     
    66 */
    77
    88( function( $ ) {
    9         var $body, $window, $document, $sidebar, adminbarOffset, top = false,
    10                 bottom = false, windowWidth, windowHeight, lastWindowPos = 0,
    11                 topOffset = 0, documentHeight, sidebarHeight, resizeTimer;
     9        var $body, $window, $sidebar, adminbarOffset, top = false,
     10            bottom = false, windowWidth, windowHeight, lastWindowPos = 0,
     11            topOffset = 0, bodyHeight, sidebarHeight, resizeTimer;
    1212
    1313        // Add dropdown toggle that display child menu items.
    1414        $( '.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>' );
     
    5252
    5353        // Sidebar scrolling.
    5454        function resize() {
    55                 windowWidth = $window.width();
    56                 windowHeight = $window.height();
    57                 documentHeight = $document.height();
     55                windowWidth   = $window.width();
     56                windowHeight  = $window.height();
     57                bodyHeight    = $body.height();
    5858                sidebarHeight = $sidebar.height();
    5959
    6060                if ( 955 >= windowWidth ) {
     
    6666        function scroll() {
    6767                var windowPos = $window.scrollTop();
    6868
    69                 if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < documentHeight ) {
     69                if ( 955 <= windowWidth && sidebarHeight + adminbarOffset < bodyHeight ) {
    7070                        if ( sidebarHeight + adminbarOffset > windowHeight ) {
    7171                                if ( windowPos > lastWindowPos ) {
    7272                                        if ( top ) {
     
    108108        $( document ).ready( function() {
    109109                $body          = $( 'body' );
    110110                $window        = $( window );
    111                 $document      = $( document );
    112                 $sidebar        = $( '#sidebar' ).first();
     111                $sidebar       = $( '#sidebar' ).first();
    113112                adminbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;
    114113
    115114                $window