I have a working Joomla extension (YT Mega menu). I want to make some updates to the existing code.
Here is the code for mouseenter
and mouseleave
:
li.addEvent('mouseenter', function (e) {
//if (objectReference.hasOpenning) return;
log('enter parent of ' + (ul ? ul.id : 'li has not child'));
li.addClass('hover');
if (ulexists) {
objectReference.showChild(ul);
}
});
li.addEvent('mouseleave', function (e) {
log('leave parent of ' + (ul ? ul.id : 'li has not child'));
li.removeClass('hover');
if (ulexists) {
if (ul.pinned) return false;
objectReference.hideChild(ul);
}
});
On mouseleave
i want a delay before hiding the ul
. is there any way to do this?
Please help. I am a beginner and confused.
On mouseleave
add a setTimeout like following
li.addEvent('mouseleave', function (e) {
setTimeout(functio(){
log('leave parent of ' + (ul ? ul.id : 'li has not child'));
li.removeClass('hover');
if (ulexists) {
if (ul.pinned) return false;
objectReference.hideChild(ul);
}
},TIME);
});
Where TIME
is the amount of time in milliseconds
you want it to wait before hiding.
Change
objectReference.hideChild(ul);
To
setTimeout(function(){
objectReference.hideChild(ul);
},time);
time in milliseconds.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.