The code below is for a drop down menu. I would like the class “hoverstate” to be removed after the slideUp is completed. The code below works, but it doesn’t trigger on main links that don’t have a child menu.
$(this).find('ul').slideUp('fast', function(){
$(this).find('a').removeClass('hoverstate');
$(this).css('z-index','1');
});
The logic should be something like this:
[ if this has children]
$(this).find('ul').slideUp('fast', function(){
$(this).find('a').removeClass('hoverstate');
$(this).css('z-index','1');
});
[/ if ]
[ else ]
$(this).find('a').removeClass('hoverstate');
$(this).css('z-index','1');
[/ else ]
I would include a link to the page, but it is password protected. Does anyone know how this syntax would be written?
Full code excerpt.
$('header.layout li').hoverIntent(
function(){
$(this).find('ul').slideDown('fast');
$(this).find('a').addClass('hoverstate');
$(this).find('li li a').removeClass('hoverstate');
$(this).css('z-index','999');
},
function(){
console.log($(this).find('ul').length);
$(this).find('ul').slideUp('fast');
$(this).find('a').removeClass('hoverstate');
$(this).css('z-index','1');
}
);
Thank you
E