Cerin
Cerin

Reputation: 64739

JQuery Show Animation From a Different Direction

How do you change the direction of jQuery's hide('slow')/show('slow') animation? By default it uses a combination of fading and sliding to/from the top-left. How would I change that to slide to/from the bottom-center or some other arbitrary direction?

For an example of a modified hide('slow') that slides to bottom-center, I tried doing $(el).animate({opacity:0, height:0, marginBottom:0}), but this doesn't seem to work.

Upvotes: 0

Views: 1712

Answers (1)

Thomas Clayson
Thomas Clayson

Reputation: 29925

The reason it animates to that point is because your element is relatively positioned by its top left point. In order to animate to the bottom center you will need to have an absolutely positioned element, and you will need to animate its height, width, bottom and left properties to get the effect that you want.

Upvotes: 1

Related Questions