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

git-svn-id: http://core.svn.wordpress.org/trunk@24511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-06-25 21:09:00 +00:00
parent 419fea1a16
commit 0c7a17d735
2 changed files with 15 additions and 20 deletions

View File

@ -218,7 +218,7 @@ function twentythirteen_scripts_styles() {
wp_enqueue_script( 'jquery-masonry' );
// Loads JavaScript file with functionality specific to Twenty Thirteen.
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130423', true );
wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130625', true );
// Loads our main stylesheet.
wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri() );

View File

@ -5,28 +5,23 @@
*/
( function( $ ) {
var html = $( 'html' ),
body = $( 'body' ),
_window = $( window ),
adjustFooter,
var body = $( 'body' ),
_window = $( window ),
/**
* Adds a top margin to the footer if the sidebar widget area is
* higher than the rest of the page, to help the footer always
* visually clear the sidebar.
* Adds a top margin to the footer if the sidebar widget area is higher
* than the rest of the page, to help the footer always visually clear
* the sidebar.
*/
adjustFooter = function() {
var sidebar = $( '#secondary .widget-area' ),
secondary = ( 0 == sidebar.length ) ? -40 : sidebar.height(),
margin = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
if ( margin > 0 && _window.innerWidth() > 999 )
$( '#colophon' ).css( 'margin-top', margin + 'px' );
};
$( function() {
if ( body.is( '.sidebar' ) )
adjustFooter();
if ( body.is( '.sidebar' ) ) {
var sidebar = $( '#secondary .widget-area' ),
secondary = ( 0 == sidebar.length ) ? -40 : sidebar.height(),
margin = $( '#tertiary .widget-area' ).height() - $( '#content' ).height() - secondary;
if ( margin > 0 && _window.innerWidth() > 999 )
$( '#colophon' ).css( 'margin-top', margin + 'px' );
}
} );
/**
@ -38,11 +33,11 @@
return;
button = nav.find( '.menu-toggle' );
menu = nav.find( '.nav-menu' );
if ( ! button )
return;
// Hide button if menu is missing or empty.
menu = nav.find( '.nav-menu' );
if ( ! menu || ! menu.children().length ) {
button.hide();
return;