Make WordPress Core

Changeset 24511


Ignore:
Timestamp:
06/25/2013 09:09:00 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Thirteen: functions.js optimizations, props obenland. Fixes #24643.

Location:
trunk/wp-content/themes/twentythirteen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentythirteen/functions.php

    r24421 r24511  
    219219
    220220    // Loads JavaScript file with functionality specific to Twenty Thirteen.
    221     wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130423', true );
     221    wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130625', true );
    222222
    223223    // Loads our main stylesheet.
  • trunk/wp-content/themes/twentythirteen/js/functions.js

    r24391 r24511  
    66
    77( function( $ ) {
    8     var html               = $( 'html' ),
    9         body               = $( 'body' ),
    10         _window            = $( window ),
    11         adjustFooter,
     8    var body    = $( 'body' ),
     9        _window = $( window ),
    1210
    1311    /**
    14      * Adds a top margin to the footer if the sidebar widget area is
    15      * higher than the rest of the page, to help the footer always
    16      * visually clear the sidebar.
     12     * Adds a top margin to the footer if the sidebar widget area is higher
     13     * than the rest of the page, to help the footer always visually clear
     14     * the sidebar.
    1715     */
    18     adjustFooter = function() {
    19         var sidebar   = $( '#secondary .widget-area' ),
    20             secondary = ( 0 == sidebar.length ) ? -40 : sidebar.height(),
    21             margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
     16    $( function() {
     17        if ( body.is( '.sidebar' ) ) {
     18            var sidebar   = $( '#secondary .widget-area' ),
     19                secondary = ( 0 == sidebar.length ) ? -40 : sidebar.height(),
     20                margin    = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
    2221
    23         if ( margin > 0 && _window.innerWidth() > 999 )
    24             $( '#colophon' ).css( 'margin-top', margin + 'px' );
    25     };
    26 
    27     $( function() {
    28         if ( body.is( '.sidebar' ) )
    29             adjustFooter();
     22            if ( margin > 0 && _window.innerWidth() > 999 )
     23                $( '#colophon' ).css( 'margin-top', margin + 'px' );
     24        }
    3025    } );
    3126
     
    3934
    4035        button = nav.find( '.menu-toggle' );
    41         menu   = nav.find( '.nav-menu' );
    4236        if ( ! button )
    4337            return;
    4438
    4539        // Hide button if menu is missing or empty.
     40        menu = nav.find( '.nav-menu' );
    4641        if ( ! menu || ! menu.children().length ) {
    4742            button.hide();
Note: See TracChangeset for help on using the changeset viewer.