i have a photo with some content on top of it (name, desc, price) the content is in a ul. in default state the ul only shows the name by setting the absolute position of the ul toward the bottom of the image and then hiding the overflow with a mask div. then when you mouseover the ul slides up showing the whole info as long as you stay on the image. when you mouseout it slides back down to its initial position just showing the title... that's how it should work. right now when you hover your mouse it slides up and down, up and down forever.
here is the html and styles
div.banner_product {
float: left; width: 236px; position: relative; overflow: visible;
}
div.banner_product ul {
width: 220px;
background-color: black;
font-size: 16px;
color: white;
list-style-type: none;
position: absolute; top: 230px;
margin: 8px;
filter: alpha(opacity=70); /* internet explorer */
-khtml-opacity: 0.7; /* khtml, old safari */
-moz-opacity: 0.7; /* mozilla, netscape */
opacity: 0.7; /* fx, safari, opera */
}
.mask {
position: absolute;
top: 0;
overflow: hidden;
height: 300px;
width: 235px;
}
/*html*/
<div class="banner_product" id="pi1"><img src="image1.jpg" alt="" border="0" height="306" width="235" /><div class="mask">
<ul id="bd1">
<li class="name-b"><a href="#">PRODUCT NAME</a></li>
<li class="text-b">DESCRIPTION</li>
<li class="price-b">PRICE</li>
</ul></div>
</div>
this is the script:
$('#pi1')
.bind('mouseover',enterImg)
.bind('mouseout',exitImg)
function enterImg(event){
$('#bd1').animate({"top": "4px"}, 2000);
event.stopPropagation();
}
function exitImg(event){
$('#bd1').animate({"top": "236px"}, 2000);
event.stopPropagation();
}