hey guys n gals. basically, I have 2 img elements, and I am trying to do a few things in this order, but my animation does not look the way I want and I seemed to have messed up reading from the img array I am using because I am also skip[ping an image ( cant put this into words but youll see when you look at the code in action)
My goal is to make it look as if the lower, hidden image is pushing the current image up and off the screen, in a timed loop, but I have only succeeded in sliding the images up individually instead, I could use some advice on this one, it's driving me nuts:
live site:
http://dansplace.zzl.org/
jq code:
Code:
var curr = -1;
var headimg = ['Boston_Skyline_Panorama_Dusk-smaller.jpg','b_diamonds.jpg','ocean.jpg'];
var base_url = "/images/"
var total_imgs = 2
function refresh2() {
if(curr >= total_imgs){
curr =0;
}else{
curr++}
$("#header img").eq(1).attr("src",base_url+headimg[curr]+"?" + Math.random());
$("#header img").eq(1).css({top:100})
if(curr >= total_imgs){
curr =0;
}else{
curr++}
$("#header img").eq(0).animate({top:-100})
$("#header img").eq(0).attr("src",base_url+headimg[curr]+"?" + Math.random());
$("#header img").eq(1).animate({top:0}).delay(100)
$("#header img").eq(0).insertAfter($("#header img").eq(1))
}
involved markup:
Code:
<div id="header">"
<img src="/images/ocean.jpg" id="headimg0">
<img src="" id="headimg1">
<ul class="headerUL">
<li class=\"current\"><a href=\"/\">Home</a></li>
<li><a href=\"/resume.php\">Resume</a></li>
<li><a href=\"/blog.php\">Future Blog</a></li>
<li><a href=\"/about.php\">About Me</a></li>
<li><a href=\"/contact.php\">Contact</a></li>
</ul>
</div>
involved css:
Code:
#headimg0 {
height: 100px;
width: 960px;
position: relative;
left: 0px;
top: 0px;
z-index: 1;
}
#headimg1 {
height: 100px;
width: 960px;
position: relative;
left: 0px;
top: 100px;
z-index: 1;
}