如何修改bootstrap的popover支持鼠标移到弹出层上弹窗层不隐藏


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM