I have a menu:
<ul>
<li class='1'>test1</li>
<li class='2'>test2</li>
<li class='3'>test3</li>
<li class='4'>test4</li>
</ul>
<br/>
<div class='clear'></div>
<div id='1' class='sub-menu'>1111111111111</div>
<div id='2' class='sub-menu'>2222222222222</div>
<div id='3' class='sub-menu'>3333333333333</div>
<div id='4' class='sub-menu'>4444444444444</div>
Each div
with number id for a li
.
I would like when mouse pointer go over li, its div is shown.
script:
$(function(){
$('li').hover(function(){
$('.sub-menu').css('display', 'none');
var id = '#' + $(this).attr('class');
$(id).css('display', 'block');
},function(){
$('.sub-menu').delay(200).fadeOut('slow');
});
$('.sub-menu').hover(function(){
$(this).css('display', 'block');
},function(){
$(this).delay(200).fadeOut('slow');
});
});
But problem is here that in div's mouseover fadeOut works and hide div. How I can stop fadeout?