WP Twenty Seventeen:手机上的菜单展开,但不向下滚动以显示菜单项

时间:2018-03-19 20:39:53

标签: jquery wordpress hamburger-menu twentyseventeen

在移动视图中点击菜单时,它只会展开,但不会向下滚动到菜单部分以显示列出的项目(在我的情况下是5个菜单项)。

我一直在寻找navigation.js,global.js和jquery.scrollTo.js文件,对我而言似乎它在某处:

// Set the active submenu initial state.
        container.find( '.current-menu-ancestor > .sub-menu' ).addClass( 'toggled-on' );

        container.find( '.dropdown-toggle' ).click( function( e ) {
            var _this = $( this ),
                screenReaderSpan = _this.find( '.screen-reader-text' );

            e.preventDefault();
            _this.toggleClass( 'toggled-on' );
            _this.next( '.children, .sub-menu' ).toggleClass( 'toggled-on' );

            _this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );

            screenReaderSpan.text( screenReaderSpan.text() === twentyseventeenScreenReaderText.expand ? twentyseventeenScreenReaderText.collapse : twentyseventeenScreenReaderText.expand );
        });
    }

    initMainNavigation( $( '.main-navigation' ) );

    masthead       = $( '#masthead' );
    menuToggle     = masthead.find( '.menu-toggle' );
    siteNavContain = masthead.find( '.main-navigation' );
    siteNavigation = masthead.find( '.main-navigation > div > ul' );

或在这里:

// Enable menuToggle.
(function() {

    // Return early if menuToggle is missing.
    if ( ! menuToggle.length ) {
        return;
    }

    // Add an initial value for the attribute.
    menuToggle.attr( 'aria-expanded', 'false' );

    menuToggle.on( 'click.twentyseventeen', function() {
        siteNavContain.toggleClass( 'toggled-on' );

        $( this ).attr( 'aria-expanded', siteNavContain.hasClass( 'toggled-on' ) );
    });
})();

任何人都可以帮助并完成这项工作吗?

这个想法是:当我点击菜单图标时,慢慢向下滚动以显示菜单项。

0 个答案:

没有答案