views:

73

answers:

2
$("li").hoverIntent({
                sensitivity: 3, 
                interval: 200, 
                over: addOver, 
                timeout: 500, 
                out: removeOver
            });
        function addOver(){ $(this).addClass('over').children('a:first').addClass('active');}
        function removeOver(){ $(this).removeClass('over').children('a:first').removeClass('active');}
        alert ('version 2 menu');
});

On mouseout I want to remove class of " li > a" if it already dont have class. I want to remove the class of the children.

Edit

If a already have the class active then then i dont want to use that ".removeClass('active')" on mouse out function.

I just want to run this function function removeOver(){ $(this).removeClass('over')

A: 

Not sure what you mean, but if you mean what I think.

$('li').mouseout(function () {
    $(this).find('> a').removeClass('over');
});

..fredrik

fredrik
A: 

I didn't really get your question but have you tried the hasClass method?

<ul>
    <li><a href="#" class="class1"><span>test</span></a></li>
    <li><a href="#"><span class="class2">test</span></a></li>
    <li><a href="#"><span>test</span></a></li>
</ul>
<script>
    $('li > a').mouseout(function() {
        ($(this).hasClass('class1')) ? $(this).removeClass('class1'):$(this).children().removeClass('class2');
    });
</script>
ifaour