Ticket #23875: 23875.3.diff
File 23875.3.diff, 2.7 KB (added by , 11 years ago) |
---|
-
wp-content/themes/twentythirteen/js/functions.js
5 5 */ 6 6 7 7 ( function( $ ) { 8 var html = $( 'html' ), 9 body = $( 'body' ), 10 navbar = $( '#navbar' ), 11 _window = $( window ), 12 navbarOffset = -1, 13 toolbarOffset = body.is( '.admin-bar' ) ? 28 : 0, 8 var html = $( 'html' ), 9 body = $( 'body' ), 10 navbar = $( '#navbar' ), 11 _window = $( window ), 12 toolbarOffset = body.is( '.admin-bar' ) ? 28 : 0, 13 navbarOffset = navbar.offset().top - toolbarOffset, 14 scrollOffsetMethod = ( typeof window.scrollY === 'undefined' ), 15 timer = 0, 14 16 adjustFooter, 15 17 adjustAnchor; 16 18 … … 48 50 /** 49 51 * Displays the fixed navbar based on screen position. 50 52 */ 51 _window.on( 'scroll.twentythirteen', function() {52 var scrollOffset = ( typeof window.scrollY === 'undefined' ) ? document.documentElement.scrollTop : window.scrollY;53 if ( navbarOffset < 0)54 navbarOffset = navbar.offset().top - toolbarOffset;53 if ( _window.innerWidth() > 644 ) { 54 _window.on( 'scroll.twentythirteen', function() { 55 if ( timer ) 56 clearTimeout( timer ); 55 57 56 if ( scrollOffset >= navbarOffset && _window.innerWidth() > 644 ) 57 html.addClass( 'navbar-fixed' ); 58 else 59 html.removeClass( 'navbar-fixed' ); 60 } ); 58 timer = setTimeout( function() { 59 var scrollOffset = scrollOffsetMethod ? document.documentElement.scrollTop : window.scrollY; 61 60 61 if ( scrollOffset > navbarOffset ) 62 html.addClass( 'navbar-fixed' ); 63 else 64 html.removeClass( 'navbar-fixed' ); 65 }, 50 ); 66 } ); 67 } 68 62 69 /** 63 70 * Allows clicking the navbar to scroll to top. 64 71 */ -
wp-content/themes/twentythirteen/functions.php
223 223 wp_enqueue_script( 'jquery-masonry' ); 224 224 225 225 // Loads JavaScript file with functionality specific to Twenty Thirteen. 226 wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130 211', true );226 wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20130416', true ); 227 227 228 228 // Loads our main stylesheet. 229 229 wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri() );