$('.container').animate({top: "0"}, 500); HTML: im using this jquery simple animate which is showing on top of the whole page, my question is, i want the animation dynamic by the users window. i mean if they scroll down the page i want the animation not going back to the top but to its current view. regards,
Ok, so to understand correctly you basically just want the container to follow the window right? What you'll need to do is add bind the window's scroll event, and update the containers top-position like so: $(window).scroll(function(e){ $('.container').offset({top: e.currentTarget.pageYOffset}); }); Code (markup): Here's a fiddle: http://jsfiddle.net/9cQWg/