Twenty Seventeen: Fix broken menu toggle in Customizer after menu items are added
This simplifies the line `$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );` to `$( siteNavContain ).toggleClass( 'toggled-on' );`, since `this` is the clicked button, so the extra context isn't needed. Props afercia, laurelfulford. Fixes #38992 for the 4.7 branch. Built from https://develop.svn.wordpress.org/branches/4.7@39423 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
909e795ba4
commit
4a0443e0db
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
var masthead, menuToggle, siteNavigation;
|
var masthead, menuToggle, siteNavContain, siteNavigation;
|
||||||
|
|
||||||
function initMainNavigation( container ) {
|
function initMainNavigation( container ) {
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
masthead = $( '#masthead' );
|
masthead = $( '#masthead' );
|
||||||
menuToggle = masthead.find( '.menu-toggle' );
|
menuToggle = masthead.find( '.menu-toggle' );
|
||||||
|
siteNavContain = masthead.find( '.main-navigation' );
|
||||||
siteNavigation = masthead.find( '.main-navigation > div > ul' );
|
siteNavigation = masthead.find( '.main-navigation > div > ul' );
|
||||||
|
|
||||||
// Enable menuToggle.
|
// Enable menuToggle.
|
||||||
|
@ -53,7 +54,7 @@
|
||||||
menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' );
|
menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' );
|
||||||
|
|
||||||
menuToggle.on( 'click.twentyseventeen', function() {
|
menuToggle.on( 'click.twentyseventeen', function() {
|
||||||
$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );
|
$( siteNavContain ).toggleClass( 'toggled-on' );
|
||||||
|
|
||||||
$( this )
|
$( this )
|
||||||
.add( siteNavigation )
|
.add( siteNavigation )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-RC1-39422';
|
$wp_version = '4.7-RC1-39423';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue