I have a navigation menu which contain sub menus. On hover I want the sub menus to show after a second delay. Menu items marked with a class of "more" contain sub menus.
Problem is that one of my functions called hoverCheck() is coming back as undefined when it's called. But I can't figure out why.
Here's my code:
$(document).ready(function() {
navigation();
});
function navigation() {
var moreMenu = $('.nav li.more');
var hovering;
function hoverCheck() {
hovering = 'hover';
openMenu();
}
function openMenu() {
if(hovering == 'hover') {
$(this).children('ul').slideDown('fast');
}
}
moreMenu.mouseenter(function() {
setTimeout("hoverCheck()",1000);
});
moreMenu.mouseleave(function() {
hovering = null;
$(this).children('ul').slideUp('fast');
});
}