Close a cluetip when the mouse is off of the link

こ雲淡風輕ζ 提交于 2019-12-24 07:47:46

问题


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...



来源:https://stackoverflow.com/questions/3246235/close-a-cluetip-when-the-mouse-is-off-of-the-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!