Make WordPress Core

Ticket #25144: 25144.diff

File 25144.diff, 1.9 KB (added by celloexpressions, 12 years ago)

switch to a css-only method for fixing the header and drop the masthead-fixed class

  • wp-content/themes/twentyfourteen/js/theme.js

     
    103103
    104104                } ).resize();
    105105
    106                 // Sticky header.
    107                 var $mastheadOffset  = -1,
    108                         $toolbarOffset = $( 'body' ).is( '.admin-bar' ) ? 32 : 0,
    109                         $maindiv = $( '#main' );
    110 
    111                 $( window ).on( 'scroll', false, function() {
    112                         if ( $mastheadOffset < 0 )
    113                                 $mastheadOffset = $masthead.offset().top - $toolbarOffset;
    114 
    115                         if ( ( window.scrollY > $mastheadOffset ) && ( $( window ).width() > 769 ) ) {
    116                                 $masthead.addClass( 'masthead-fixed' );
    117                                 $maindiv.css( {
    118                                         marginTop: $masthead.height()
    119                                 } );
    120                         } else {
    121                                 $masthead.removeClass( 'masthead-fixed' );
    122                                 $maindiv.css( {
    123                                         marginTop: 0
    124                                 } );
    125                         }
    126                 } );
    127 
    128106                // Arranges footer widgets vertically.
    129107                if ( $.isFunction( $.fn.masonry ) ) {
    130108
  • wp-content/themes/twentyfourteen/style.css

     
    582582        width: 100%;
    583583        z-index: 3;
    584584}
    585 
    586 /* Fixed Header */
    587 .site-header.masthead-fixed {
    588         box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
    589         position: fixed;
    590                 top: 0;
    591 }
    592 .admin-bar .site-header.masthead-fixed {
    593         top: 28px;
    594 }
    595 .admin-bar.mp6 .site-header.masthead-fixed {
    596         top: 32px;
    597 }
    598585#site-header {
    599586        position: relative;
    600587        z-index: 3;
     
    26622649}
    26632650
    26642651@media screen and (min-width: 770px) {
     2652        /* Fixed Header */
     2653        .site-header {
     2654                box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
     2655                position: fixed;
     2656                top: 0;
     2657        }
     2658        .admin-bar .site-header {
     2659                top: 28px;
     2660        }
     2661        .admin-bar.mp6 .site-header {
     2662                top: 32px;
     2663        }
     2664        .site-main {
     2665                margin-top: 48px;
     2666        }
     2667       
    26652668        .header-main {
    26662669                margin-right: 0;
    26672670        }