I have a problem with this JQuery code:
$(".item").mouseenter(function(){
$(this).addClass("active");
$(this).removeClass("item");
$(".item").hide(700);
}).mouseleave(function(){
$(this).stop();
$(this).addClass("item");
$(this).removeClass("active");
$(".item").show(700);
});
and this is my HTML:
<ul>
<li class="item">Item</li>
<li class="item">Item</li>
<li class="item">Item</li>
<li class="item">Item</li>
<li class="item">Item</li>
</ul>
I want when I do hover on one item, other items be hide, the code works fine but the problem is there if I hover another item in duration of hiding (700 ms), it will make a loop of hide/show items. what can I do for prevent this.
note: I want the hovered item goes to left, not stay fixed.