Reputation: 61
i am trying to make a little div show up inside a wrapper div when its on hover and it all works good but for example if i pass from a wrapper to the wrapper next to it the first little div on the first wrapper stay like stuck i think it is a stop() problem so how can i fix it, thanks.
$(function(){
$(".show-more").hide()
$(".product-box").hover(function(){
$(this).stop().children(".show-more").show("slide", { direction: "down" }, 300);
})
$(".product-box").mouseleave(function(){
$(this).stop().children(".show-more").hide("slide", { direction: "down" }, 300);
})
});
the HTML CODE is:
<div class="product-box">
<div class="show-more">
</div>
<img src="'.$pic.'" />
<ul>
<li>'.$designiation.'</li>
<li>'.$type.'</li>
<li><strong>'.$variete.'</strong></li>
</ul>
</div>'
this html code is inside a php loop.
Upvotes: 1
Views: 293
Reputation: 40639
Try this,
$(".product-box").hover(function(){
$(this).find(".show-more").stop().slideDown(300);
},function(){
$(this).find(".show-more").stop().slideUp(300);
});
Read slideDown() and slideUp()
Upvotes: 0
Reputation: 206348
Something like this?
$(".product-box").hover(function(){
$(this).find(".show-more").stop().slideToggle(300);
});
Remember that hover used as a named method .hover()
is a way to register both mouseenter
and mouseleave
events.
Upvotes: 1
Reputation: 5992
working fiddle: http://jsfiddle.net/patelmilanb1/DDqFm/
$(function () {
$(".show-more").hide();
$(".product-box").hover(function () {
$(this).find(".show-more").slideDown(300);
}, function () {
$(this).find(".show-more").slideUp(300);
});
});
Upvotes: 0