如何修改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