I am trying to create a sticky header which changes size when the page is scrolled. One of the main features I want to implement is that an image in the header shrinks down and moves to the left.
So far I have the shrinking down working nicely all animated. I also have the moving to the left working, but its not animated.
In jQuery I am calling
$('#page_header_logo_img').css({
"padding-left":"20%",
"display":"inline"
})
at one point and then later call
$('#page_header_logo_img').css({
"padding-left":"0",
"display":"block"
})
Which works beautifully for moving it to exactly where I want... only problem is it jumps there.
I have tried incorporating the jQuery Animate effect but couldn't get it to work.
Here is a JSFiddle of what I currently have All I need is for the movement left and right to be smooth and not instant.
EDIT FOR ANSWER
I accepted the answer that got me closest, and also answered the question I asked. However it didn't quite get me what I wanted, so thought I would post the final solution here.
I changed the image to be position: absolute;
and then dynamically set the margin and the left property.