Ticket #38502: 38502.patch
File 38502.patch, 2.8 KB (added by , 8 years ago) |
---|
-
assets/js/global.js
142 142 // Fires on document ready 143 143 $( document ).ready( function() { 144 144 145 // Let's fire some JavaScript!146 setNavProps();145 // If navigation menu is present on page, setNavProps and adjustScrollClass 146 if( $navigation.length ) { 147 147 148 setNavProps(); 149 adjustScrollClass(); 150 } 151 152 // If 'Scroll Down' arrow in present on page, calculate scroll offset and bind an event handler to the click event 148 153 if ( $menuScrollDown.length ) { 149 154 150 /**151 * 'Scroll Down' arrow in menu area152 */153 155 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 154 156 menuTop -= 32; 155 157 } … … 156 158 if ( $( 'body' ).hasClass( 'blog' ) ) { 157 159 menuTop -= 30; // The div for latest posts has no space above content, add some to account for this 158 160 } 161 if ( ! $navigation.length ) { 162 navigationOuterHeight = 0; 163 } 164 159 165 $menuScrollDown.click( function( e ) { 160 166 e.preventDefault(); 161 167 $( window ).scrollTo( '#primary', { … … 163 169 offset: { 'top': menuTop - navigationOuterHeight } 164 170 } ); 165 171 } ); 166 167 adjustScrollClass();168 172 } 169 173 170 174 adjustHeaderHeight(); … … 175 179 } 176 180 } ); 177 181 178 if ( 'true' === twentyseventeenScreenReaderText.has_navigation ) { 182 // If navigation menu is present on page, adjust it on scroll and screen resize 183 if ( $navigation.length ) { 179 184 180 185 // On scroll, we want to stick/unstick the navigation 181 186 $( window ).on( 'scroll', function() { … … 187 192 $( window ).resize( function() { 188 193 setNavProps(); 189 194 setTimeout( adjustScrollClass, 500 ); 190 setTimeout( adjustHeaderHeight, 1000 );191 195 } ); 192 196 } 193 197 … … 196 200 resizeTimer = setTimeout( function() { 197 201 belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' ); 198 202 }, 300 ); 203 setTimeout( adjustHeaderHeight, 1000 ); 199 204 } ); 200 205 201 206 }( jQuery ) ); -
functions.php
305 305 306 306 $twentyseventeen_l10n = array( 307 307 'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ), 308 'has_navigation' => 'false',309 308 ); 310 309 311 310 if ( has_nav_menu( 'top' ) ) { 312 311 wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '1.0', true ); 313 $twentyseventeen_l10n['has_navigation'] = 'true';314 312 $twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' ); 315 313 $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' ); 316 314 $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'expand', 'fallback' => true ) );