javascript 下拉切换在bootstrap 5中不起作用

ryhaxcpt  于 2023-01-07  发布在  Java
关注(0)|答案(1)|浏览(139)

它不工作,一旦我升级到Bootstrap 5.

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria- controls="navbarCollapse" aria-expanded="false" aria- label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

样本代码:https://github.com/Devgroup-Asia/larablog/blob/main/resources/views/include/navbar.blade.php

tjvv9vkg

tjvv9vkg1#

<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria- controls="navbarCollapse" aria-expanded="false" aria- label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

您可以使用此代码。在bootstrap 5中,只有使用data-bs-{variable_name}时,数据属性才有效。

相关问题