我已经设置了Bootstrap Navbar,但是当我尝试单击汉堡包时,我的控制台上出现此错误:
Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at a.t._getParent (collapse.js:308)
at new a (collapse.js:88)
at HTMLDivElement.<anonymous> (collapse.js:351)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at n.fn.init.a._jQueryInterface (collapse.js:337)
at HTMLDivElement.<anonymous> (collapse.js:385)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at HTMLButtonElement.<anonymous> (collapse.js:381)
这是我的导航栏:
<nav id="header_navbar" class="navbar navbar-expand-md navbar-light bg-header">
<a href="http://localhost/wordpress" class="navbar-brand"><img class="navbar-img" src="http://localhost/wordpress/wp-content/themes/Avada/images/technisol_logo.png"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" data-parent="accordian-10">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent" data_parent="#header_navbar">
<ul class="navbar-nav justify-content-end"><li class="nav-item">
<a class="nav-link text-dark" href="http://localhost/wordpress/login">Connexion</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" href="http://localhost/wordpress/register">Inscription</a>
</li>
</ul>
</div>
我尝试了许多在Internet上找到的解决方案,例如:https://github.com/twbs/bootstrap/issues/26891
或者这一个: Cannot read property 'querySelectorAll' of null bootstrap collapse
什么都没有改变。
有什么想法吗?