Wednesday, 18 December 2013

Mouseover and mouseout functionality in jQuery


Mouseover and mouseout functionality in jQuery

var hideDelay = 500;
var hideDelayTimer = null;

jQuery(".setWarn").mouseover(function(){
        if (hideDelayTimer) clearTimeout(hideDelayTimer);
jQuery("#warning-dialog").slideDown(120);


}).mouseout(function(){
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer = setTimeout(function (){
jQuery("#warning-dialog").slideUp(120);
},hideDelay);
});

jQuery("#warning-dialog").mouseover(function(){
if (hideDelayTimer) clearTimeout(hideDelayTimer);
jQuery("#warning-dialog").slideDown(120);
}).mouseout(function(){
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer = setTimeout(function (){
jQuery("#warning-dialog").slideUp(120);
},hideDelay);
});

 });

No comments: