1 设置延时, 超过该延时未移入弹窗则弹窗隐藏
Tooltip.prototype.init = function{中的
var triggers = this.options.trigger.split(‘ ‘)后面加上
//设置延时
if (this.options.trigger.indexOf(‘hover‘) > -1) {
$.extend(true, this.options, { delay: { hide: 100 } });
}
2 控制不消失代码
在Tooltip.prototype.enter = function (obj) {中的
clearTimeout(self.timeout)后加入
if (self.options.trigger.indexOf(‘hover‘) > -1) {
self.$tip.unbind(‘mouseenter‘).bind(‘mouseenter‘, function (e) {
self.$tip.data(‘data-element‘, self.$element);//触发popover框的点击事件时可以获取id
clearTimeout(self.timeout);
self.hoverState = ‘in‘;
}).unbind(‘mouseleave‘).bind(‘mouseleave‘, function (e) {
self.hoverState = ‘out‘;
self.timeout = setTimeout(function () {
if (self.hoverState == ‘out‘) self.hide()
}, self.options.delay.hide)
})
}
bootstrap版本:v3.3.6
如何修改bootstrap的popover支持鼠标移到弹出层上弹窗层不隐藏
原文:http://www.cnblogs.com/qmgcs/p/5346446.html