Scipion
Scipion

Reputation: 11888

Transition on position change in css

I would like to add a transition on an element when I am changing its position (from static to fixed).

I tried doing a transition: transition: position 2s linear; but it actually doesn't do anything. Is there anything else I could try ?

Thanks

Upvotes: 2

Views: 179

Answers (1)

TheThirdMan
TheThirdMan

Reputation: 1522

You're using the declaration properly, however you can only transition numeric values - this is because transition will calculate inbetween steps for the two values you're transitioning between, and while 0% and 100% have steps inbetween, there is no valuefor three-quarters-fixed-one-quarter-static.

The working draft for the transition shorthand has a few pointers on what can reasonably be animated.

In other words, you won't be able to animate this with transition, so the only possible way is likely through JS at this point. With the code you provided, that is impossible to say, though.

Upvotes: 2

Related Questions