Twenty Seventeen: Remove unnecessary l10n variables
* Relies on header skip link instead of l10n variables in JavaScript. * Fixes issue where scroll down arrow appeared next to the navigation on the front page with no header image or video. It now only appears with a big header. Props enodekciw, laurelfulford. Fixes #38502. Built from https://develop.svn.wordpress.org/trunk@39073 git-svn-id: http://core.svn.wordpress.org/trunk@39015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3711c0664d
commit
906eb80953
|
@ -142,20 +142,25 @@
|
|||
// Fires on document ready
|
||||
$( document ).ready( function() {
|
||||
|
||||
// Let's fire some JavaScript!
|
||||
setNavProps();
|
||||
// If navigation menu is present on page, setNavProps and adjustScrollClass
|
||||
if( $navigation.length ) {
|
||||
setNavProps();
|
||||
adjustScrollClass();
|
||||
}
|
||||
|
||||
// If 'Scroll Down' arrow in present on page, calculate scroll offset and bind an event handler to the click event
|
||||
if ( $menuScrollDown.length ) {
|
||||
|
||||
/**
|
||||
* 'Scroll Down' arrow in menu area
|
||||
*/
|
||||
if ( $( 'body' ).hasClass( 'admin-bar' ) ) {
|
||||
menuTop -= 32;
|
||||
}
|
||||
if ( $( 'body' ).hasClass( 'blog' ) ) {
|
||||
menuTop -= 30; // The div for latest posts has no space above content, add some to account for this
|
||||
}
|
||||
if ( ! $navigation.length ) {
|
||||
navigationOuterHeight = 0;
|
||||
}
|
||||
|
||||
$menuScrollDown.click( function( e ) {
|
||||
e.preventDefault();
|
||||
$( window ).scrollTo( '#primary', {
|
||||
|
@ -163,8 +168,6 @@
|
|||
offset: { 'top': menuTop - navigationOuterHeight }
|
||||
} );
|
||||
} );
|
||||
|
||||
adjustScrollClass();
|
||||
}
|
||||
|
||||
adjustHeaderHeight();
|
||||
|
@ -175,7 +178,8 @@
|
|||
}
|
||||
} );
|
||||
|
||||
if ( 'true' === twentyseventeenScreenReaderText.has_navigation ) {
|
||||
// If navigation menu is present on page, adjust it on scroll and screen resize
|
||||
if ( $navigation.length ) {
|
||||
|
||||
// On scroll, we want to stick/unstick the navigation
|
||||
$( window ).on( 'scroll', function() {
|
||||
|
@ -187,7 +191,6 @@
|
|||
$( window ).resize( function() {
|
||||
setNavProps();
|
||||
setTimeout( adjustScrollClass, 500 );
|
||||
setTimeout( adjustHeaderHeight, 1000 );
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -196,6 +199,7 @@
|
|||
resizeTimer = setTimeout( function() {
|
||||
belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' );
|
||||
}, 300 );
|
||||
setTimeout( adjustHeaderHeight, 1000 );
|
||||
} );
|
||||
|
||||
}( jQuery ) );
|
||||
|
|
|
@ -368,12 +368,10 @@ function twentyseventeen_scripts() {
|
|||
|
||||
$twentyseventeen_l10n = array(
|
||||
'quote' => twentyseventeen_get_svg( array( 'icon' => 'quote-right' ) ),
|
||||
'has_navigation' => 'false',
|
||||
);
|
||||
|
||||
if ( has_nav_menu( 'top' ) ) {
|
||||
wp_enqueue_script( 'twentyseventeen-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '1.0', true );
|
||||
$twentyseventeen_l10n['has_navigation'] = 'true';
|
||||
$twentyseventeen_l10n['expand'] = __( 'Expand child menu', 'twentyseventeen' );
|
||||
$twentyseventeen_l10n['collapse'] = __( 'Collapse child menu', 'twentyseventeen' );
|
||||
$twentyseventeen_l10n['icon'] = twentyseventeen_get_svg( array( 'icon' => 'angle-down', 'fallback' => true ) );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
'menu_id' => 'top-menu',
|
||||
) ); ?>
|
||||
|
||||
<?php if ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) : ?>
|
||||
<?php if ( ( twentyseventeen_is_frontpage() || ( is_home() && is_front_page() ) ) && has_custom_header() ) : ?>
|
||||
<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>
|
||||
<?php endif; ?>
|
||||
</nav><!-- #site-navigation -->
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-beta1-39072';
|
||||
$wp_version = '4.7-beta1-39073';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue