单击切换按钮时,折叠菜单未关闭

时间:2019-06-26 09:28:04

标签: javascript html css bootstrap-4

我用Bootstrap 4.0.0构建了一个响应式菜单,当我单击折叠菜单时,它会打开,但是当我再次单击它时,它不会关闭。 代码是:

html:

<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <a href="index.php"><img class="nav-link" src="wp-content\themes\VillanovaTheme\img\home.svg"
            id="homeimage"></a>
    <button id="bottone" class="navbar-toggler js-scroll-trigger" type="button" data-toggle="collapse"
        data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
        aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item active">
                <a class="nav-link js-scroll-trigger" href="#1">Luoghi di pregio e personaggi di spicco</a>
            </li>
            <li class="nav-item active">
                <a class="nav-link js-scroll-trigger" href="#2">Eventi culturali ed enogastronomici</a>
            </li>
            <li class="nav-item active">
                <a class="nav-link js-scroll-trigger" href="#3">Strutture ricettive presenti nel territorio di
                    Villanova di Camposampiero</a>
            </li>
            <li class="nav-item active">
                <a class="nav-link js-scroll-trigger" href="#4">Servizi</a>
            </li>
            <li class="nav-item active">
                <a class="nav-link js-scroll-trigger" href="#5">Contatti</a>
            </li>
        </ul>
    </div>
</nav>

1 个答案:

答案 0 :(得分:0)

我通过删除jquery和popper.js并保留

解决了该问题