So here's my code:
var timeouts = {};
$('#nav ul > li').mouseenter(function() {
clearTimeout(timeouts['menu']);
$(this).find('div.dropdown').stop(true).slideDown(200);
});
$('#nav ul > li').mouseleave(function() {
timeouts['menu'] = setTimeout(function() {
$(this).find('div.dropdown').stop(true).slideUp(200);
}, 1000)
});
This doesn't seem to be working. Any idea? Is there any other way to achieve my goal? The code now works when I hover my mouse over but the div will not slide up when my mouse leaves.