
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Set how many seconds or milliseconds a transition effect takes to complete.
To set the duration for an effect to complete, use the transitionDuration property in JavaScript.
Example
You can try to run the following code to return how many seconds or milliseconds a transition effect takes to complete −
<!DOCTYPE html> <html> <head> <style> #div1 { position: relative; margin: 10px; height: 300px; width: 400px; padding: 20px; border: 2px solid blue; } #div2 { padding: 80px; position: absolute; border: 2px solid BLUE; background-color: yellow; transform: rotateY(45deg); transition: all 5s; } #div2:hover { background-color: orange; width: 50px; height: 50px; padding: 100px; border-radius: 50px; } </style> </head> <body> <p>Hover over DIV2</p> <button onclick = "display()">Set</button> <div id = "div1">DIV1 <div id = "div2">DIV2</div> </div> <script> function display() { document.getElementById("myDIV").style.transitionDuration = "5s"; } </script> </body> </html>
- Related Articles
- Set how many seconds or milliseconds a CSS transition effect takes to complete
- Set a delay for the CSS transition effect
- How to set when the transition effect will start with JavaScript?
- How to set the speed curve of the transition effect with CSS
- How to create a transition effect with CSS?
- How to set the CSS property that the transition effect is for with JavaScript?
- How to delay the Transition Effect with CSS
- Set the name of the CSS property the transition effect is for
- How to get min, seconds and milliseconds from datetime.now() in Python?
- A simple pendulum takes 32 seconds to complete 20 oscillations. What is the time period of this pendulum?
- A simple pendulum takes 32 seconds to complete 20 oscillations. What is the time period of the pendulum?
- Create a transition effect on hover pagination with CSS
- Image Transition with Fading Effect using JavaScript
- Remove Seconds/ Milliseconds from Date and convert to ISO String?
- How to set the four transition properties with JavaScript?

Advertisements