I have this image that I got to animate itself down the page at random points in the browsers width. Now I want it to do it automatically without me refreshing the page. This is what I have so far. Any resources or hints would be awesome! Thank you so much in advance.
#ash = my image ID
#container = div around img
$(function () {
var random = Math.floor(Math.random(8) * $(window).width());
var $ash = jQuery('#ash');
var $con = jQuery('#container');
$con.css( {"width" : $(document).width(),
"height" : $(window).height()
})
$ash.css( "left" , random);
$ash.animate({
"top" : $(window).height() - 269,
"opacity" : 0
}, 2000);
});

New Topic/Question
Reply



MultiQuote


|