HTML | DOM Style transitionDelay Property
The transitionDelay property in HTML DOM is used to specify the time in seconds or milliseconds when execution of transition starts. The delay refers to the time, which to be waited before starting the transition effect.
Syntax:
- It returns the transitionDelay property.
object.style.transitionDelay
- It sets the transitionDelay property.
object.style.transitionDelay = "time|initial|inherit"
Property Values:
- time: It specifies the length of time (in seconds or milliseconds) to start transition animation.
Syntax:object.style.transitionDelay = "time";
Example:
<!DOCTYPE html><html><head><title>HTML DOM Style transitionDelay Property</title><!-- CSS property for transition animation --><style>#GFG {border: 1px solid black;background-color: white;width: 250px;height: 200px;overflow: auto;-webkit-transition: all 3s;transition: all 3s;text-align:center;}#GFG:hover {background-color: green;width: 300px;height: 100px;text-align:center;}</style></head><body><buttononclick="myGeeks()">Click Here!</button><br><br><divid="GFG"><h1>GeeksforGeeks</h1></div><!-- script for transition delay --><script>function myGeeks() {document.getElementById("GFG").style.WebkitTransitionDelay= "3s";document.getElementById("GFG").style.transitionDelay= "3s";}</script></body></html>chevron_rightfilter_noneOutput:
Before click on the Button:

After click on the Button: Transition delay : 3 seconds

- initial: It sets the transitionDelay property to its default value.
Syntax:object.style.transitionDelay = "initial";
Example:
<!DOCTYPE html><html><head><title>HTML DOM Style transitionDelay Property</title><!-- CSS property for transition animation --><style>#GFG {border: 1px solid black;background-color: white;width: 250px;height: 200px;overflow: auto;-webkit-transition: all 3s;transition: all 3s;text-align:center;}#GFG:hover {background-color: green;width: 300px;height: 100px;text-align:center;}</style></head><body><buttononclick="myGeeks()">Click Here!</button><br><br><divid="GFG"><h1>GeeksforGeeks</h1></div><!-- script for transition delay --><script>function myGeeks() {document.getElementById("GFG").style.WebkitTransitionDelay= "initial";document.getElementById("GFG").style.transitionDelay= "initial";}</script></body></html>chevron_rightfilter_noneOutput:
Before click on the Button:

After click on the Button: Transition delay : 0 seconds. Because default transition delay is 0 seconds.

- inherit: The transitionDelay property is inherited from its parent.
Syntax:object.style.transitionDelay = "inherit";
Example 3:
<!DOCTYPE html><html><head><title>HTML DOM Style transitionDelay Property</title><!-- CSS property for transition animation --><style>#GFG {border: 1px solid black;background-color: white;width: 250px;height: 200px;overflow: auto;-webkit-transition: all 3s;transition: all 3s;text-align:center;}#main {transition-delay:2s;-webkit-transition-delay:2s}#GFG:hover {background-color: green;width: 300px;height: 100px;text-align:center;}</style></head><body><buttononclick="myGeeks()">Click Here!</button><br><br><divid="main"><divid="GFG"><h1>GeeksforGeeks</h1></div></div><!-- script for transition delay --><script>function myGeeks() {document.getElementById("GFG").style.WebkitTransitionDelay= "inherit";document.getElementById("GFG").style.transitionDelay= "inherit";}</script></body></html>chevron_rightfilter_noneOutput:
Before click on the Button:

After click on the Button: Transition delay : 2 seconds. Because the parent class contains transition delay 2 seconds.

Return Value: It returns a string value which represents the transitionDelay property of an element.
Supported Browsers: The browser supported by DOM transitionDelay property are listed below:
- Google Chrome 26.0
- Internet Explorer 10.0
- Firefox 16.0
- Safari 6.1, 3.1 WebkitTransitionDelay
- Opera 12.1
Recommended Posts:
- HTML | DOM Style right Property
- HTML | DOM Style top Property
- HTML | DOM Style borderColor Property
- HTML | DOM Style backgroundSize Property
- HTML | DOM Style borderImage Property
- HTML | DOM Style alignSelf Property
- HTML | DOM Style borderBottomLeftRadius Property
- HTML | DOM Style borderRightWidth Property
- HTML | DOM Style borderLeftStyle Property
- HTML | DOM Style backgroundRepeat Property
- HTML | DOM Style boxShadow Property
- HTML | DOM Style outline Property
- HTML | DOM Style columnRuleStyle Property
- HTML | DOM Style borderRightStyle Property
- HTML | DOM Style minWidth Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



