我正在尝试使用bootstrap nav下拉菜单创建一个网站的模型。我还是新手,我已经阅读了关于此的帖子并尝试了各种编辑,但是当我点击它时,我的下拉列表仍然没有激活。任何建议或指示将非常感激。谢谢!
链接到我的jsfiddle:https://jsfiddle.net/allisoncodes/sdywsaf4/10/
HTML:
<div class="dropdown">
<button class="btn btn-default">
<a href="#home">
<icon class="fa fa-home"></icon>
</a>
</button>
<button class="btn btn-default dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">Community
<span class="caret"></span></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" href="#" data-toggle="tab">Recent Activity</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" href="#" data-toggle="tab">Member Forum</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" href="#" data-toggle="tab">Member List</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" href="#" data-toggle="tab">Member Groups</a></li>
</ul>
<button class="btn btn-default">
<a href="#">Pet Help</a></button>
<button class="btn btn-default"><a href="#">Pets For Sale</a></button>
<button class="btn btn-default"><a href="#">Pets Services</a></button>
<div class="content">
</div>
</div>
jQuery:
$('[data-toggle=tab]').hover(function (e) {
$(this).click();
});
答案 0 :(得分:0)
事实证明我的代码是正确的,我只是忘了包含jQuery CDN。谢谢你的帮助!