8 | | /** |
9 | | * Repositions the window on jump-to-anchor to account for |
10 | | * navbar height. |
11 | | */ |
12 | | var twentyThirteenAdjustAnchor = function() { |
13 | | if ( window.location.hash ) |
14 | | window.scrollBy( 0, -49 ); |
| 8 | var twentyThirteen = { |
| 9 | /** |
| 10 | * Sets the content area to the same hight as the sidebar, if the |
| 11 | * sidebar is higher, to avoid overflow. |
| 12 | */ |
| 13 | adjustFooter : function() { |
| 14 | var content = $( '#content' ), |
| 15 | height = $( '#tertiary .widget-area' ).height() + 40; // 40px padding top. |
| 16 | |
| 17 | if ( height > content.height() ) |
| 18 | content.css( 'height', height + 'px' ); |
| 19 | }, |
| 20 | |
| 21 | /** |
| 22 | * Repositions the window on jump-to-anchor to account for navbar |
| 23 | * height. |
| 24 | */ |
| 25 | adjustAnchor : function() { |
| 26 | if ( window.location.hash ) |
| 27 | window.scrollBy( 0, -49 ); |
| 28 | } |
17 | | $( document ).on( 'ready', twentyThirteenAdjustAnchor ); |
18 | | $( window ).on( 'hashchange', twentyThirteenAdjustAnchor ); |
| 31 | $( document ).on( 'ready', function() { |
| 32 | twentyThirteen.adjustAnchor(); |
| 33 | |
| 34 | if ( body.is( '.sidebar' ) ) |
| 35 | twentyThirteen.adjustFooter(); |
| 36 | } ); |
| 37 | $( window ).on( 'hashchange', twentyThirteen.adjustAnchor ); |