css - jQuery Animate Upwards -


I have an issue where I have a div that is uniquely positioned and I close the page upwards I want to do it (I'm animating the person who jumps on the screen)

However, I need to have the element below: 0, but when I want to finish the animation, I get the image above Have to keep: -600px.

When I write

  $ ("# jumper"). Chetan ({top: "-600px"}, 2000, 'ease in back');  

It sets from top to top 0 and then the animation begins.

Perhaps there is a way to get the sum of the element and set the top with jQuery.css (on window load)?

What should I do here?

How about just about down animate property? You can get the height of the document, then you can add 600 .

  var height = $ (document) .height (); $ ("# Jumper"). Animate ({bottom: height = 600}, 2000, 'ease inbox');  

Otherwise, you run on browser specific issues where head is calculated as auto , and starts with animation That situation (which ends in 0, I think) tries to be.

In order to create that task, you will have to get the top position of the # jumper and before you manually set that value to the top Set. / P>

  var top = $ ('# jumper'). Offset (). Top; $ ("# Jumper"). CSS ({top: up, down: 'auto'}). Sammet ({Top: -600}, 2000, 'Comfortback');  

Edit: The second code must also be set as down as auto / P>


Comments