Ticket #38502: 38502.1.patch
File 38502.1.patch, 3.9 KB (added by , 8 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/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 setNavProps(); 148 adjustScrollClass(); 149 } 147 150 151 // If 'Scroll Down' arrow in present on page, calculate scroll offset and bind an event handler to the click event 148 152 if ( $menuScrollDown.length ) { 149 153 150 /**151 * 'Scroll Down' arrow in menu area152 */153 154 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 154 155 menuTop -= 32; 155 156 } … … 156 157 if ( $( 'body' ).hasClass( 'blog' ) ) { 157 158 menuTop -= 30; // The div for latest posts has no space above content, add some to account for this 158 159 } 160 if ( ! $navigation.length ) { 161 navigationOuterHeight = 0; 162 } 163 159 164 $menuScrollDown.click( function( e ) { 160 165 e.preventDefault(); 161 166 $( window ).scrollTo( '#primary', { … … 163 168 offset: { 'top': menuTop - navigationOuterHeight } 164 169 } ); 165 170 } ); 166 167 adjustScrollClass();168 171 } 169 172 170 173 adjustHeaderHeight(); … … 175 178 } 176 179 } ); 177 180 178 if ( 'true' === twentyseventeenScreenReaderText.has_navigation ) { 181 // If navigation menu is present on page, adjust it on scroll and screen resize 182 if ( $navigation.length ) { 179 183 180 184 // On scroll, we want to stick/unstick the navigation 181 185 $( window ).on( 'scroll', function() { … … 187 191 $( window ).resize( function() { 188 192 setNavProps(); 189 193 setTimeout( adjustScrollClass, 500 ); 190 setTimeout( adjustHeaderHeight, 1000 );191 194 } ); 192 195 } 193 196 … … 196 199 resizeTimer = setTimeout( function() { 197 200 belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' ); 198 201 }, 300 ); 202 setTimeout( adjustHeaderHeight, 1000 ); 199 203 } ); 200 204 201 205 }( jQuery ) ); -
src/wp-content/themes/twentyseventeen/functions.php
368 368 369 369 $twentyseventeen_l10n = array( 370 370 'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ), 371 'has_navigation' => 'false',372 371 ); 373 372 374 373 if ( has_nav_menu( 'top' ) ) { 375 374 wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '1.0', true ); 376 $twentyseventeen_l10n['has_navigation'] = 'true';377 375 $twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' ); 378 376 $twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' ); 379 377 $twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) ); -
src/wp-content/themes/twentyseventeen/template-parts/navigation/navigation-top.php
16 16 'menu_id' => 'top-menu', 17 17 ) ); ?> 18 18 19 <?php if ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page()) ) : ?>19 <?php if ( ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) && has_custom_header() ) : ?> 20 20 <a href="#content" class="menu-scroll-down"><?php echo twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ); ?><span class="screen-reader-text"><?php _e( 'Scroll Down', 'twentyseventeen' ); ?></span></a> 21 21 <?php endif; ?> 22 22 </nav><!-- #site-navigation -->