typeahead搜索提示
来源:互联网 发布:淘宝详情页图片下载器 编辑:程序博客网 时间:2024/06/05 23:16
一:引入样式文件与js
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script type="text/JavaScript" src="~/Content/js/bootstrap-typeahead.js"></script>
二:建立一个文本框
<input type="text" id="s_mdport" />
注意样式冲突一般该input父级对a的样式可能会影响到他
三:绑定typeahead
五:特殊需求默认提示
六:修改一些样式,宽度,背景色等
效果:
1:修改颜色
把css里边的默认蓝色全部替换成#13c0a2,下次要修改样式直接在这个基础上把#13c0a2全部替换成其他颜色就行了
2:修改宽度
.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:330px;......}
min-width:330p修改成想要的宽度就可以了
3:右边出现文字,就是就是拼一个a标签
});
七:点击时弹出提示
1:要监听点击方法
.on('click', $.proxy(this.click, this)) //要监听点击事件不然就不会执行了
2:点击方法里边做处理,调用回调函数,他默认是在lookup事件里写的,参照他写就可以
click: function (e) { //aj点击时的提示
var items
this.query = this.$element.val()
//if (!this.query || this.query.length < this.options.minLength) { //这个是限制为空就不查询了,取消掉
// return this.shown ? this.hide() : this
//}
if (this.shown == false) {
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
return items ? this.process(items) : this
}
else
{
var val = this.$menu.find('.active').attr('data-value')
this.$element
.val(this.updater(val))
.change()
return this.hide()
}
//e.stopPropagation()
//e.preventDefault()
//this.select()
//this.$element.focus()
}
一:引入样式文件与js
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script type="text/JavaScript" src="~/Content/js/bootstrap-typeahead.js"></script>
二:建立一个文本框
<input type="text" id="s_mdport" />
注意样式冲突一般该input父级对a的样式可能会影响到他
三:绑定typeahead
五:特殊需求默认提示
六:修改一些样式,宽度,背景色等
效果:
1:修改颜色
把css里边的默认蓝色全部替换成#13c0a2,下次要修改样式直接在这个基础上把#13c0a2全部替换成其他颜色就行了
2:修改宽度
.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:330px;......}
min-width:330p修改成想要的宽度就可以了
3:右边出现文字,就是就是拼一个a标签
});
七:点击时弹出提示
1:要监听点击方法
.on('click', $.proxy(this.click, this)) //要监听点击事件不然就不会执行了
2:点击方法里边做处理,调用回调函数,他默认是在lookup事件里写的,参照他写就可以
click: function (e) { //aj点击时的提示
var items
this.query = this.$element.val()
//if (!this.query || this.query.length < this.options.minLength) { //这个是限制为空就不查询了,取消掉
// return this.shown ? this.hide() : this
//}
if (this.shown == false) {
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
return items ? this.process(items) : this
}
else
{
var val = this.$menu.find('.active').attr('data-value')
this.$element
.val(this.updater(val))
.change()
return this.hide()
}
//e.stopPropagation()
//e.preventDefault()
//this.select()
//this.$element.focus()
}
- typeahead搜索提示
- typeahead搜索提示
- ElasticSearch的搜索推荐(typeahead)
- boostrap 搜索框typeahead自动补全
- twitter-bootstrap-typeahead文本框搜索提醒组件
- bootstrap+typeahead实现输入提示功能
- bootstrap-typeahead结合ajax动态提示
- typeahead模糊搜索查询-结合bootstrap和jquery
- 搜索提示
- 由Typeahead想到的搜索的本质,和OO和数据库是统一的
- TYPEAHEAD helloworld
- typeahead/autocomplete
- js搜索提示参考
- js搜索提示框
- 仿google搜索提示
- JQUERY实现搜索提示
- 類似 搜索提示功能
- nlpcn搜索提示资源
- react-router4.0版本的改变
- android 下拉选择框Spinner
- iOS源码资源之各种项目源码汇总
- 通用分销渠道和通用产品组的解析
- JS事件之事件类型[鼠标和滚轮事件]
- typeahead搜索提示
- linux- epoll
- '\0'和"\0"的区别
- Linux下使用Nexus搭建Maven私服
- Qt使用OpenSSL
- js格式化日期
- 【转】使用Kubeadm快速搭建Kubernetes(docker)
- 选择排序---堆排序
- SQL server数据类型