wp-bootstrap-navwalker icon indicating copy to clipboard operation
wp-bootstrap-navwalker copied to clipboard

Toggle Not Working on Mobile Devices

Open NickMcBurney opened this issue 12 years ago • 2 comments

Hi,

I have the menu working perfectly on the desktop version but when I try and test the site using a mobile device (tried on iPhone4 and Google Nexus 5) the toggle button doesnt expand the menu.

This is the code im using:

<nav class="navbar navbar-default" role="navigation">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse navbar-ex1-collapse">
            <?php
            wp_nav_menu( array(
                'theme_location' => 'header-navigation',
                'depth' => 2,
                'container' => false,
                'menu_class' => 'nav navbar-nav',
                'fallback_cb' => 'wp_page_menu',
                //Process nav menu using our custom nav walker
                'walker' => new wp_bootstrap_navwalker())
            );
            ?>
        </div><!-- /.navbar-collapse --> 
</nav>

and you can see the site here: http://create.tuscorlloyds.com.

Ive read various StackOverflow answers/solutions but cant get it to work.

Anyone had this isssue before? THanks Nick

NickMcBurney avatar Jun 11 '14 16:06 NickMcBurney

The code is no longer view-able at the given link and this post is old as well. However, looking at your code I see no reason why it shouldn't run. Did you include jQuery and the bootstrap.js file in your theme? Also, did you include jQuery BEFORE you included bootstrap.js?

LouisMilotte avatar Sep 02 '14 16:09 LouisMilotte

Looking at your previous post im going to assume that it is an issue with the fact that you wanted to link top level items. Since theres no hover on a mobile device you wouldn't get a dropdown with your modified code. This is when Bootstrap does not natively support dropdown on hover, it creates bad UX.

SideQuestDIY avatar Sep 03 '14 18:09 SideQuestDIY