I have a list like this:
<ul>
<li><a href="#"><img src="/userfiles/test.png" alt="" /></a></li>
<li><a href="#"><img src="/userfiles/test2.png" alt="" /></a></li>
</ul>
Each of these image is 950 pixels wide and 600 pixels in height.
The first 300 pixel in height is the mouse-out image and the last 300 pixel is the mouse-over image I want to fade over. Is this possible?
I have this CSS to control what image to show:
ul { list-style: none; padding: 0; margin: 0; }
ul li { width: 950px; height: 300px; overflow: hidden; position: relative; }
ul li img {
display: block;
position: absolute;
top: 0;
left: 0;
}
This code just moves the last 300 pixels of the image up, but instead of moving it I want to opacity fade the image over the "other":.
<script type="text/javascript">
$(document).ready(function () {
$("ul li img").mouseover(function () {
$(this).stop().animate(
{ top: "-300px" },
{ duration: 300 })
})
.mouseout(function () {
$(this).stop().animate(
{ top: "0" },
{ duration: 300 })
})
});
</script>