Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS3, WebKit Transition Order? How to queue to the transitions?

Tags:

html

css

webkit

I have the following:

-webkit-transition-property: top, bottom, z-index;
-webkit-transition-duration: 0.5s;

Problem is I don't want the z-index to transition until after top & bottom are done.

Is there a way to tell Webkit transition to transition top/bottom and then when done, do z-index instantly or with the duration, either way?

Thanks

like image 947
AnApprentice Avatar asked Apr 11 '11 17:04

AnApprentice


People also ask

How do you add transition effects in CSS3?

To make the transition occur, you must specify at least two things — the name of the CSS property to which you want to apply the transition effect using the transition-property CSS property, and the duration of the transition effect (greater than 0) using the transition-duration CSS property.

Which of the following is shorthand method to use transition?

The transition CSS property is a shorthand property for transition-property , transition-duration , transition-timing-function , and transition-delay .


2 Answers

You have to specify a delay on the z-index transition:

-webkit-transition-property: top, bottom, z-index;
-webkit-transition-duration: 0.5s;
-webkit-transition-delay: 0s, 0s, .5s;
like image 74
DuMaurier Avatar answered Oct 20 '22 03:10

DuMaurier


And for your info, in javascript, you can also listen on the webkitTransitionEnd event and modify the z-index when this event is fired.

This event have two useful properties :

  • propertyName : the name of the property involved in the transistion
  • elapsedTime : time elapsed during the transistion
like image 43
jdramaix Avatar answered Oct 20 '22 03:10

jdramaix