I need a hand making this code below working. I’ve had it working so that when the user hovers over the image it animates up, then down when losing focus, but now I want it to run on window load on an infinite loop.
$(document).ready(function(){
$(window).load(function(){
$('.navImage').animate({top:'-=13'}, 700)
}, function(){
$('.navImage').animate({top:'+=13'}, 700);
});
});
At the moment it’s only animating 13pixels up, not down, and obviously the animation doesn’t currently loop. Do I need to use some sort of callback?
Any help would be great, thanks.
[EDIT] Removed the height:toggle, didn’t mean to include that.
Try this:
=== UPDATE 1 ===
Also see my jsfiddle.
=== UPDATE 2 ===
Now they start with random delay:
Also see my jsfiddle 2.
=== Update 3 ===
And in this jsfiddle additional with random speed: jsfiddle 3.