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.


git-svn-id: https://develop.svn.wordpress.org/trunk@39419 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David A. Kennedy 2016-12-02 06:24:12 +00:00
parent 4eb6d688a5
commit df0a35d0d9

View File

@ -6,7 +6,7 @@
*/
(function( $ ) {
var masthead, menuToggle, siteNavigation;
var masthead, menuToggle, siteNavContain, siteNavigation;
function initMainNavigation( container ) {
@ -39,6 +39,7 @@
masthead = $( '#masthead' );
menuToggle = masthead.find( '.menu-toggle' );
siteNavContain = masthead.find( '.main-navigation' );
siteNavigation = masthead.find( '.main-navigation > div > ul' );
// Enable menuToggle.
@ -53,7 +54,7 @@
menuToggle.add( siteNavigation ).attr( 'aria-expanded', 'false' );
menuToggle.on( 'click.twentyseventeen', function() {
$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );
$( siteNavContain ).toggleClass( 'toggled-on' );
$( this )
.add( siteNavigation )