Twenty Thirteen: enable a JavaScript-based fix for long sidebar areas that overflow the footer. Props obenland, fixes #23557.
git-svn-id: https://develop.svn.wordpress.org/trunk@23676 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
90d4a19ced
commit
297f1c0f20
@ -5,17 +5,40 @@
|
||||
*/
|
||||
|
||||
( function( $ ) {
|
||||
/**
|
||||
* Repositions the window on jump-to-anchor to account for
|
||||
* navbar height.
|
||||
*/
|
||||
var twentyThirteenAdjustAnchor = function() {
|
||||
if ( window.location.hash )
|
||||
window.scrollBy( 0, -49 );
|
||||
var twentyThirteen = {
|
||||
/**
|
||||
* 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' );
|
||||
else
|
||||
console.log( 'nothing' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Repositions the window on jump-to-anchor to account for navbar
|
||||
* height.
|
||||
*/
|
||||
adjustAnchor : function() {
|
||||
if ( window.location.hash )
|
||||
window.scrollBy( 0, -49 );
|
||||
}
|
||||
};
|
||||
|
||||
$( document ).on( 'ready', twentyThirteenAdjustAnchor );
|
||||
$( window ).on( 'hashchange', twentyThirteenAdjustAnchor );
|
||||
$( document ).on( 'ready', function() {
|
||||
twentyThirteen.adjustAnchor();
|
||||
|
||||
if ( body.is( '.sidebar' ) )
|
||||
twentyThirteen.adjustFooter();
|
||||
} );
|
||||
$( window ).on( 'hashchange', twentyThirteen.adjustAnchor );
|
||||
|
||||
/**
|
||||
* Displays the fixed navbar based on screen position.
|
||||
|
Loading…
Reference in New Issue
Block a user