mouseover - Hoverstate on parent jQuery script works only one way -



mouseover - Hoverstate on parent jQuery script works only one way -

i want parent items in navigation have hover or active state when hover on kid items.

so looked around , found out can utilize jquery accomplish this. made script:

<script> jquery(document).ready(function($) { var $nav = $('#productnav ul.sub-menu li'); $nav.mouseover(function() { $("#productnav ul.sf-menu li.deeper").addclass(' overstate ') } ); $nav.mouseleave(function() { $("#productnav ul .sf-menu li.deeper").removeclass(' overstate ') } ); }); </script>

after few hours (and reading lot), got work. partially.

the class added parent, works fine. not removed. tried create hover method jquery same result.

anybody know what's wrong in script?

regards, hans

check this:

$("#productnav ul.sf-menu li.deeper") $("#productnav ul .sf-menu li.deeper")

try remove blank space between "ul" , ".sf" of sec selector.

the rest of code looks fine , should work.

jquery mouseover addclass removeclass mouseout

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -