普通网友 2019-04-16 18:00
浏览 72

WP Bootstrap Navwalker移动菜单不起作用

I am using the WP bootstrap navwalker for my wordpress site. The desktop version of the menu is working properly but there's some problem with the hamburger menu. The hamburger menu is showing up but the collapse thing is not working. Here's my Navwalker Menu:

    <nav class="navbar navbar-expand-lg navbar-light bg-color">
  <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span>   
    <i class="fas fa-bars"></i>
    </span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mx-auto">
    <?php
      wp_nav_menu( array(
    'theme_location'  => 'primary',
    'depth'           => 2, // 1 = no dropdowns, 2 = with dropdowns.
    'container'       => 'div',
    'container_class' => 'collapse navbar-collapse',
    'container_id'    => 'bs-example-navbar-collapse-1',
    'menu_class'      => 'navbar-nav mr-auto',
    'fallback_cb'     => 'WP_Bootstrap_Navwalker::fallback',
    'walker'          => new WP_Bootstrap_Navwalker(),
) );
    ?>
    </ul>

  </div>

</nav>

and here's my enqueued scripts:

//Register WP NAVWALKER
    require_once('wp-bootstrap-navwalker.php');

    //Theme Support
    function wpb_theme_setup(){
        //NAV Menus
        register_nav_menus(array(
            'primary' =>__('Primary Menu')
        ));

        //CSS Files
        wp_enqueue_style('font-awesome', '//use.fontawesome.com/releases/v5.5.0/css/all.css');

        wp_enqueue_style('bootstrap', '//stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css');

        wp_enqueue_style('owl-carasoul', '//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.css');

        wp_enqueue_style( 'baguette-box', '//cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.css');

        wp_enqueue_style('main-css', get_stylesheet_uri(), NULL, microtime(), false);


        //Scripts 

        wp_enqueue_script('jquery', '//cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js', NULL,'1.0', false);

        wp_enqueue_script('owl', '//cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js', NULL, '1.0', true);

        wp_enqueue_script('bootstrap-js', '//stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js', NULL, '4.1.3', true);

        wp_enqueue_script('baguette-js', '//cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.10.0/baguetteBox.min.js', NULL, '1.10.0', false);

    }

    add_action('after_setup_theme', 'wpb_theme_setup');
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集