For some reason the DIV I want to animated is animating from the top down… I want to animate it from where it is UP to the end destination.
The DIV is starting as position: fixed to the bottom of the page.
This is what I’m doing right now:
var div2Pos = $("#feature-header-wrapper").position();
$("#123456").css('position', 'absolute');
$("#123456").animate({top: div2Pos.top}, 1000);
I think that this is what you want:
Demo: http://jsfiddle.net/SO_AMK/Q6KNk/
jQuery:
HTML:
CSS:
Basically it gets
div2‘s position then sets#squareto it’s current position but using absolute instead of fixed positioning so that the animation occurs instead of it jumping to the top.NOTE: This will not work if
squareis inside of a relatively positioned element!