Bootstrap工具提示在悬停时保持打开状态

jle*_*gio 1 html javascript css jquery twitter-bootstrap

我在我的网页上设置了引导工具提示.当您滚动图像时,工具提示会显示,在工具提示中我有一个链接,当我滚动实际工具提示以单击链接时......它会消失.

我的问题(我奇怪似乎无法在任何地方找到答案)是当我将鼠标悬停在实际的工具提示本身上时,如何让工具提示保持打开状态.

我已经看过并尝试过一些可以设置延迟的解决方案,但我宁愿不去那个方向,因为我不喜欢这种效果.

任何帮助都会很棒,谢谢!

小智 5

var originalLeave = $.fn.tooltip.Constructor.prototype.leave;
$.fn.tooltip.Constructor.prototype.leave = function(obj){
  var self = obj instanceof this.constructor ?
    obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
  var container, timeout;

  originalLeave.call(this, obj);

  if(obj.currentTarget) {
    container = $(obj.currentTarget).siblings('.tooltip')
    timeout = self.timeout;
    container.one('mouseenter', function(){
      //We entered the actual popover – call off the dogs
      clearTimeout(timeout);
      //Let's monitor popover content instead
      container.one('mouseleave', function(){
        $.fn.tooltip.Constructor.prototype.leave.call(self, self);
      });
    })
  }
};


$('body').tooltip({ selector: '[data-toggle]', trigger: 'click hover', placement: 'bottom auto', delay: {show: 50, hide: 400}});
Run Code Online (Sandbox Code Playgroud)