jquery 怎么实现输入框查找关键字并提亮颜色
时间:2022-06-25 17:00:46 编辑:袖梨 来源:一聚教程网
实例代码如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | < div > < a class = "btn btn-success show" title = "Popover title" data-container = "body" data-toggle = "popover" data-placement = "bottom" data-content = "底部的 Popover 中的一些内容" > aaaa </ a > </ div > < script > $(function () { initPopover(); }) function initPopover() { $(".show").popover({ container: "body", trigger: " manual" //手动触发 }).on('show.bs.popover', function () { $(this).addClass("popover_open"); }).on('hide.bs.popover', function () { $(this).removeClass("popover_open"); }); $(".show").click(function () { if ($(this).hasClass("popover_open")) { $(this).popover("hide") } else { $(".popover_open").popover("hide"); $(this).popover("show"); } var e = arguments.callee.caller.arguments[0] || event; e.stopPropagation(); }); $(document).click(function () { $(".show").popover("hide"); }); } </ script > |
注意点:
1、不适用于button,a、img等可用
2、show.bs.popover:当调用show 实例方法时立即触发该事件。
shown.bs.popover:当弹出框对完全弹出时触发该事件(将等待 CSS 过渡效果完成)。
hide.bs.popover:当调用hide 实例方法时立即触发该事件。
hidden.bs.popover:当工具提示完全隐藏时触发该事件(将等待 CSS 过渡效果完成)。
3、引入jquery和bootstrap头文件
4、取消冒泡
相关文章
- 《弓箭传说2》新手玩法介绍 01-16
- 《地下城与勇士:起源》断桥烟雨多买多送活动内容一览 01-16
- 《差不多高手》醉拳龙技能特点分享 01-16
- 《鬼谷八荒》毕方尾羽解除限制道具推荐 01-16
- 《地下城与勇士:起源》阿拉德首次迎新春活动内容一览 01-16
- 《差不多高手》情圣技能特点分享 01-16