0

I am trying to keep bootstrap tooltip alive while being hovered so I followed vikas' answer here (How can I keep bootstrap popover alive while the popover is being hovered?). I made something like:

element.tooltip({
   html: true
}).on('mouseenter', function () {
   var _this = this;
   $(this).tooltip('show');
   $('.tooltip').on('mouseleave', function () {
       $(_this).tooltip('hide');
   });
}).on('mouseleave', function () {
   var _this = this;
   setTimeout(function () {
      if (!$('.tooltip:hover').length) {
         $(_this).tooltip('hide')
      }
}, 100);
});

That works fine in most web browsers (Chrome, Firefox, Safari, IE) except Opera. In Opera, $('.tooltip:hover').length always returns 0. Is there a way to make it compatible with Opera?

Or do you know an alternative way to check whether mouse is currently over tooltip content or not?

Community
  • 1
  • 1
rei
  • 31
  • 2
  • `if (!$('.tooltip:hover').length) {` why checking for `not` try with this: `if ($('.tooltip:hover').length) {` – Jai Mar 31 '14 at 11:42
  • @Jai If I do that then tooltip will be disapppeared when we hover mouse over tooltip content. – rei Mar 31 '14 at 11:48
  • @Satpal I think it will check if mouse is currently over tooltip content. – rei Mar 31 '14 at 11:50
  • @Dhaval Why? Do you think it is better to use popover here? – rei Mar 31 '14 at 11:52

0 Answers0