Close a cluetip when the mouse is off of the link

2019-07-30 03:03发布

问题:

Is there an option to close a cluetip dialog when the mouse is moved off of the link? There is the mouseOutClose option, but it doesn't close the cluetip if you don't hover over it first.

Here is an example:

http://plugins.learningjquery.com/cluetip/demo/ - the first link under the jTip Theme

回答1:

In the clueTips core file replace the code:

if (opts.mouseOutClose) {....}

with

if (opts.mouseOutClose) {
var closectip;
$cluetip.hover(function() {
clearTimeout(closectip);
},
function() {
$closeLink.trigger('click');
});
$this.hover(function() {
clearTimeout(closectip);

}, function() {
closectip = setTimeout(cluetipClose, 1000);
});
} 

I found the solution from a jquery forum here is the link

http://plugins.jquery.com/content/cluetip-doesnt-close-mouseout

Its working for me.



回答2:

I had the same trouble, and I got a solution.

It's working.

So, what we all want is a way to

1- showing cluetip when link is hovered, then discard it when mouse goes out

2- BUT keep cluetip opened if the mouse did go inside so that it can click on links inside the cluetip

This is how to do it.

Just add this parameter :

sticky:    true, 
onShow:   function(){ 
                 $('.mylink').mouseout(function() {     // if I go out of the link, then...
                    var closing = setTimeout(" $(document).trigger('hideCluetip')",400);  // close the tip after 400ms
                    $("#cluetip").mouseover(function() { clearTimeout(closing); } );    // unless I got inside the cluetip
                 });
          }

This is it !



回答3:

It's because the sticky option is set to true...