Twitter Bootstrap 2:导航栏子菜单链接不起作用
更新到 Twitter Bootstrap 2.0(非常棒)后,子菜单内部的导航链接不起作用。
jQuery 版本为 1.7.1。下拉菜单实际上可以工作,并且标记是正确的(根据文档):
<!-- start navbar -->
<div class="navbar navbar-fixed-top" id="navbar">
<!-- start navbar-inner -->
<div class="navbar-inner">
<!-- start container-fluid -->
<div class="container-fluid">
<?php echo anchor('home', 'SCAA', array('class' => 'brand')); ?>
<ul class="nav">
<li class="dropdown" data-toggle="dropdown">
<?php echo anchor('#', 'Inscripciones <span class="caret"></span>', array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown')); ?>
<ul class="dropdown-menu">
<li><?php echo anchor('inscriptions/add', 'Nueva Inscripción'); ?></li>
<li class="divider"></li>
<li><?php echo anchor('inscriptions', 'Mostrar Todas'); ?></li>
</ul>
</li>
</ul>
<!-- end nav -->
</div>
<!-- end container-fluid -->
</div>
<!-- end navbar-inner -->
</div>
<!-- end navbar -->
注意:我正在使用 Codeigniter 生成链接,但使用普通标签也不起作用。
插件正在正确加载。
我正在使用 jQuery('.dropdown-toggle').dropdown(); 调用下拉菜单;
我不知道还要做什么或检查什么。有什么提示吗?
After updating to Twitter Bootstrap 2.0 (which is awesome), the navigation links inside submenus do not work.
jQuery is at 1.7.1. The Dropdowns actually work, and the markup is correct (according to the docs):
<!-- start navbar -->
<div class="navbar navbar-fixed-top" id="navbar">
<!-- start navbar-inner -->
<div class="navbar-inner">
<!-- start container-fluid -->
<div class="container-fluid">
<?php echo anchor('home', 'SCAA', array('class' => 'brand')); ?>
<ul class="nav">
<li class="dropdown" data-toggle="dropdown">
<?php echo anchor('#', 'Inscripciones <span class="caret"></span>', array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown')); ?>
<ul class="dropdown-menu">
<li><?php echo anchor('inscriptions/add', 'Nueva Inscripción'); ?></li>
<li class="divider"></li>
<li><?php echo anchor('inscriptions', 'Mostrar Todas'); ?></li>
</ul>
</li>
</ul>
<!-- end nav -->
</div>
<!-- end container-fluid -->
</div>
<!-- end navbar-inner -->
</div>
<!-- end navbar -->
Note: I'm using Codeigniter to generate the links, but with plain tags isn't working either.
The plugins are being loaded correctly.
I'm calling the dropdowns with jQuery('.dropdown-toggle').dropdown();
I don't know what else to do or check. Any hints?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标记不正确(至少不完全) - 问题是包含
要使其工作,只需从列表元素中删除
data-toggle="dropdown"
属性即可完成。The markup is not correct (at least, not entirely) - the problem was the declaration of data-toggle="dropdown" inside the containing
<li>
element. It should be in the 1st child of that list element.To make it work, simple delete the
data-toggle="dropdown"
attribute from the list element and it'll be done.