$(document).ready(function(){
function anima() {
$(".box").stop().animate({bottom:'0px'},{queue:false,duration:160});
}
$('ul#aa img').hover(function(){
$(this).parent().append("<div class='box'>Artist<br/>More</div>", anima());
}, function() {
$(".box").stop().animate({bottom:'-100px'},{queue:false,duration:160, complete: function(){
$('.box').remove();} });
});
<ul id="aa"><li id="bb">
<img src="delete.jpg"title="one|date|location|detail"/>
</li>
</ul>
I am trying to add a div box on hover, then making it slide up (this part works), but then on mouse-out I would like to animate it down and remove the div (doesn’t work, just removes, doesn’t animate).
Also: $('#caption', this)?
What does this call? Setting the caption inside this element?
I figured it out, I had to use flags as well as it was creating a new div everytime on hover before the older one was deleted. Not sure if you can use slideup/slidetoggle here with the queue attribute?
This does not work for more than one
liitem though, I need for infinite number of items, how can I have flags per item?edit: Instead of flags you can just use
if(($(this).next().length)==0)to check if the div is there or not. I updated the code.