I can easily animate divs FROM the stylesheet position to another position using JQuery, but is there an easy way to do the reverse? Basically I want to avoid changing my stylesheet, yet have divs start off the page and be animated into their correct position.
Asked
Active
Viewed 79 times
4 Answers
1
You can try doing something like this:
var origt = $("#yourdiv").offset().top, origl = $("#yourdiv").offset().left;
$("#yourdiv").css({top:"auto", left:"auto"}); /*or wherever you want them to start*/
$("#yourdiv").animate({top:origt, left: origl});
Hope that helped!

Chris
- 26,544
- 5
- 58
- 71
0
Set the div's display: none;
Find the original location via javascript.
Move them outside of the visible window.
Change them back to display: block;
Animate them from current position back to original values stored in JS.

David Houde
- 4,835
- 1
- 20
- 29
0
I think you are asking: Can one pass class names to jQuery animate instead of defining an object literal of css properties.
http://stackoverflow.com/questions/1248542/jquery-animate-with-css-class-only-without-explicit-styles

jForrest
- 107
- 5