bootstrap popover 如何在hover状态移动到弹出上不消失
bootstrap中的popover其实就是对tooltip做了一定升级,拥有了标题和内容
概要
- 使用的时候依赖第三方插件
- 依赖tooltip插件
- 必须初始化
- title 和 content 可以在popover上展示
- 指定
container:'body'属性,它就会在body中生成相应的div,也可以局限在某个元素中 - 含有
display的无法显示出popover - 内容和标题没有的时候不会显示popover
- 当在多行文本中展示的时候,popover会居中,可以使用
white-space
$(function () {
$('.example-popover').popover({
container: 'body'
})
})
配置
| 名字 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| animation | boolean | true | 允许使用动画 |
| container | string | false | popover在哪个元素中的后面展示 |
| content | string or element or element | '' | 如果元素中存在 data-content属性就不起作用,如果使用function,需要return html内容 |
| delay | number | 0 | 延迟显示和隐藏弹出框的毫秒数 - 对 manual 手动触发类型不适用 delay:{ show: 500, hide: 100 } |
| html | boolean | false | 向弹出框插入 HTML |
| placement | string or function | 'right' | top or bottom or left or right 也可以使用auto 也可以用 function 第一个参数是弹出的dom,第二个参数是触发的dom |
| selector | string | false | 提供了一个选择器,弹出框对象将被委派到指定的目标 |
| template | string | '
' |
html属性为true,可以修改popover的模板 |
| title | string or function or element | '' | 同content |
| trigger | string | 'click' | 可以指定不同的触发事件 click hover focus manual 其中manual不能和任何一起使用 |
方法

事件

实现
上面已经介绍了popover的很多东西,来具体看看如何实现
$(".pop").popover({ trigger: "manual" , html: true, animation:false})
.on("mouseenter", function () {
var _this = this; // 这里的this触发的dom,需要存起来 否则在下面 .popover的逻辑中this会变为弹出的dom
$(this).popover("show");
$(".popover").on("mouseleave", function () {
$(_this).popover('hide');
});
}).on("mouseleave", function () {
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
}
}, 300);
});
demo http://jsfiddle.net/mayufo/369dp5sy/2/
参考资料
https://v4-alpha.getbootstrap.com/components/popovers/
http://www.runoob.com/bootstrap/bootstrap-popover-plugin.html
bootstrap popover 如何在hover状态移动到弹出上不消失的更多相关文章
- bootstrap 弹出框点击其他区域时弹出框不消失选项设置
默认情况下,bootstrap 弹出框点击其他区域时,弹出框会自动关闭,在很多时候,我们可能会希望达到和原生弹出框一样的效果,避免不小心点击其他区域时弹框自动隐藏,尤其是对于一些复杂的表单,重复填写可 ...
- 整理:手机端弹出提示框,使用的bootstrap中的模态框(modal,弹出层),比kendo弹出效果好
效果图: 我的代码示例: <!--提示模态框--> <div class="modal fade" id="myModal" tabindex ...
- bootstrap中的模态框(modal,弹出层)
默认的modal示例: <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset= ...
- Jquery hover鼠标经过时弹出div动态提示语
一.效果图 二.需求描述 1.鼠标经过table每一行时,弹出div动态提示语: 2.div弹出层的位置随鼠标位置的变化而变化: 3.鼠标离开table或获取的动态提示语为空时,div弹出层消失. 下 ...
- bootstrap中使用modal加载kindeditor时弹出层文本框不能输入的问题
答案来自老外http://stackoverflow.com/questions/14795035/twitter-bootstrap-modal-blocks-text-input-field $( ...
- Bootstrap Popover 隐藏的Javasript方法
Bootstrap Popover是Bootstrap的弹出提示控件.我们可以通过data属性或者Javascript来调用该控件.data属性调用定制性较差这里就不细说了,我们讲一下Javascri ...
- Bootstrap Popover
[Bootstrap Popover] 1.设置一个popover需要添加以下设置: 1)data-toggle="popover" 2)title="Example p ...
- Bootstrap-Plugin:弹出框(Popover)插件
ylbtech-Bootstrap-Plugin:弹出框(Popover)插件 1.返回顶部 1. Bootstrap 弹出框(Popover)插件 弹出框(Popover)与工具提示(Tooltip ...
- 第二百四十六节,Bootstrap弹出框和警告框插件
Bootstrap弹出框和警告框插件 学习要点: 1.弹出框 2.警告框 本节课我们主要学习一下 Bootstrap 中的弹出框和警告框插件. 一.弹出框 弹出框即点击一个元素弹出一个包含标题和内容的 ...
随机推荐
- AngularJS 入门教程
1. 简介:AngularJS是为了克服HTML在构建应用上的不足而设计的.HTML是一门很好的为静态文本展示设计的声明式语言,但要构建WEB应用的话它就显得乏力了.所以我做了一些工作(你也可以觉得是 ...
- hdu 1507(二分图匹配)
Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- AC日记——曼哈顿交易 洛谷 P3730
曼哈顿交易 思路: 都是套路: 代码: #include <cmath> #include <cstdio> #include <cstring> #include ...
- [libGDX游戏开发教程]使用libGDX进行游戏开发(1)-游戏设计
声明:<使用Libgdx进行游戏开发>是一个系列,文章的原文是<Learning Libgdx Game Development>,大家请周知.后续的文章连接在这里 使用Lib ...
- #!bin/sh是啥
第一句的#!是对脚本的解释器程序路径,脚本的内容是由解释器解释的,我们可以用各种各样的解释器来写对应的脚本,比如说/bin/csh脚本,/bin/perl脚本,/bin/awk脚本,/bin/sed脚 ...
- centos6.5 卸载adobeflash
# rpm -e flash-plugin # rpm -qa | grep ^flash-plugin
- CF 1005B Delete from the Left 【模拟数组操作/正难则反】
You are given two strings s and t. In a single move, you can choose any of two strings and delete th ...
- A - Enterprising Escape 【BFS+优先队列+map】
The Enterprise is surrounded by Klingons! Find the escape route that has the quickest exit time, and ...
- Codeforces #430 Div2 D
#430 Div2 D 题意 给出一些数,每次操作先将所有数异或一个值,再求这些数中没有出现过的最小的非负整数. 分析 对于更新操作,对于 \(x\) 所有为 \(1\) 的位给相应层添加一个标记,当 ...
- [Hackerrank]时间转换Time Conversion
题目链接 大致要求是说给定一个十二小时制的时间,给出它的二十四小时制的形式. 输入格式:hh:mm:ssAM 或者 hh:mm:ssPM,其中01≤hh≤12,00≤mm,ss≤59 思路 判断字符串 ...