twitter-bootstrap - Angular bootstrap 下拉切换 - 通过键盘箭头键导航

标签 twitter-bootstrap angularjs

我正在使用 Bootstrap 的下拉切换指令。但我可以通过鼠标导航菜单,但不能通过键盘箭头键。 请让我知道如何通过键盘上/下箭头键进行导航。

查看这个笨蛋:http://plnkr.co/edit/m5TBlkVMVJHVF69V2635?p=preview

最佳答案

对于 Bootstrap 下拉菜单,向上/向下箭头依赖于能够“聚焦” anchor ,这需要指定 href 属性。

<ul class="dropdown-menu">
  <li ng-repeat="choice in items">
    <a href="javascript:void(0)">{{choice}}</a>
  </li>
</ul>

注意使用 href="javascript:void(0)" 而不是通常的 href="#",因为后者会导致 AngularJS 重新加载页面由于路线改变。

关于twitter-bootstrap - Angular bootstrap 下拉切换 - 通过键盘箭头键导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19226673/

相关文章:

html - 如果 anchor 没有 href 属性,则保留 anchor 样式

jquery - 使用数组动态 Bootstrap 多选分组

javascript - 如何在 C# .net 中将 .aspx 页面另存为 html 文件时绘制动态 JQ 图

angularjs - 如何将变量注入(inject)指令的范围?

javascript - ng-选择第一个不隐藏的

javascript - 突出显示 HTML 中的特定单词

javascript - 单元测试 Angular/ ionic 项目

javascript - 更改 Bootstrap btn css 和悬停操作问题

twitter-bootstrap - 来自 bootstrap.sass nuget 的 SASS 文件在哪里

javascript - 无法使用 Angular forEach循环将对象推送到数组中