From df0a35d0d95b6011b3b9a98b8f71bb841680fd41 Mon Sep 17 00:00:00 2001 From: "David A. Kennedy" Date: Fri, 2 Dec 2016 06:24:12 +0000 Subject: [PATCH] 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 --- .../themes/twentyseventeen/assets/js/navigation.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-content/themes/twentyseventeen/assets/js/navigation.js b/src/wp-content/themes/twentyseventeen/assets/js/navigation.js index c1af2af3fa..da50e0fae1 100644 --- a/src/wp-content/themes/twentyseventeen/assets/js/navigation.js +++ b/src/wp-content/themes/twentyseventeen/assets/js/navigation.js @@ -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 )