带有选择框事件

时间:2018-01-04 11:14:58

标签: jquery bootstrap-4

我需要实现一个可滚动的下拉菜单,其中包含选择框功能,例如将鼠标悬停在网页的按键上。

例如: 我的下拉菜单包含大约100个元素, 苹果 蚂蚁 球 橙子 ....

菜单必须是可滚动的。 如果我按下A' ' Apple'应该悬停。 如果我按下A' Ant应该悬停。 上下箭头应悬停在上一个和下一个元素上。 我不需要文本框,如"选择"。

请告诉我一个更好的方法来实现它。

1 个答案:

答案 0 :(得分:0)

我不确定我完全理解你在寻找什么,但Angular ui-select可能只是一个简单的选择。

Angular ui-select示例 http://plnkr.co/edit/?p=preview

<ui-select ng-model="ctrl.person.selected" theme="select2" ng-disabled="ctrl.disabled" style="min-width: 300px;" title="Choose a person">
<ui-select-match placeholder="Select a person in the list or search his name/age...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="person in ctrl.people | propsFilter: {name: $select.search, age: $select.search}">
  <div ng-bind-html="person.name | highlight: $select.search"></div>
  <small>
    email: {{person.email}}
    age: <span ng-bind-html="''+person.age | highlight: $select.search"></span>
  </small>
</ui-select-choices>

我在jQuery中可以想到的最接近的事情就是他们的自动完成输入,但它看起来不像你正在寻找的那种cmoplexity https://jqueryui.com/autocomplete/