加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

twitter-bootstrap-3 – bootstrap-tagsinput with typeahead,bo

发布时间:2020-12-17 21:34:18 所属栏目:安全 来源:网络整理
导读:在我的一个项目中,我曾经在bootstrap-2.3.2中使用bootstrap-tags输入 http://timschlechter.github.io/bootstrap-tagsinput.最近我更新了两个(bootstrap为3,tagsinput为0.3.9).在更新期间,我发现外部的tagsinput取决于 http://twitter.github.io/typeahead.j
在我的一个项目中,我曾经在bootstrap-2.3.2中使用bootstrap-tags输入 http://timschlechter.github.io/bootstrap-tagsinput.最近我更新了两个(bootstrap为3,tagsinput为0.3.9).在更新期间,我发现外部的tagsinput取决于 http://twitter.github.io/typeahead.js/.

我尝试根据文档使用bs-tagsinput和typeahead.那有点颠簸.例如,bootstrap-tagsinput docs下的typeahead代码示例:

$('input').tagsinput('input').typeahead({
  prefetch: 'citynames.json'
}).bind('typeahead:selected',$.proxy(function (obj,datum) {  
  this.tagsinput('add',datum.value);
  this.tagsinput('input').typeahead('setQuery','');
},$('input')));
</script>

typeahead [‘setQuery’]不再存在于typeahead ver 1.0中(它在ver 0.9中).我对数据集使用typeahead.source方法.来自’source’的typeahead没有在0.9中实现,因此降级似乎不是一个选项.我不确定是否用typeahead [‘val’]替换它(尽管两者都没有解决我看到的问题).
至于CSS,我从bootstrap-tagsinput docs页面复制了它 – 不确定这是意图(我是新手,所以我不知道更好).

问题是,把所有东西放在一起后,我遇到了错误的行为(如预期的那样).具体来说,我在插入标签(输入一个单词并按下回车)后面临一个问题:
(1)tt -down-down菜单应该消失但是没有.它与之前的tt-suggestions列表一起发布

(2)tt-hint字段应该被清除但不是

如果我使用箭头选择其中一个tt-advice,就不会发生这个问题

有谁知道什么是获取tagsinput-w / typeahead功能的最佳方法?

解决方法

twitter.github.io/typeahead.js与bootstrap 3不兼容.

您可以使用与twitter bootstrap 3兼容的Typeahead

https://github.com/bassjobsen/Bootstrap-3-Typeahead

实际上开发人员将bootstrap 2代码迁移到bootstrap 3这里的细节是http://bassjobsen.weblogs.fm/migrate-your-templates-from-twitter-bootstrap-2-x-to-twitter-bootstrap-3/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读