Make WordPress Core

Changeset 39419


Ignore:
Timestamp:
12/02/2016 06:24:12 AM (8 years ago)
Author:
davidakennedy
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/navigation.js

    r39232 r39419  
    77
    88(function( $ ) {
    9     var masthead, menuToggle, siteNavigation;
     9    var masthead, menuToggle, siteNavContain, siteNavigation;
    1010
    1111    function initMainNavigation( container ) {
     
    4040    masthead       = $( '#masthead' );
    4141    menuToggle     = masthead.find( '.menu-toggle' );
     42    siteNavContain = masthead.find( '.main-navigation' );
    4243    siteNavigation = masthead.find( '.main-navigation > div > ul' );
    4344
     
    5455
    5556        menuToggle.on( 'click.twentyseventeen', function() {
    56             $( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );
     57            $( siteNavContain ).toggleClass( 'toggled-on' );
    5758
    5859            $( this )
Note: See TracChangeset for help on using the changeset viewer.