JavaScript Animation ontransitionend Event
You are Here:
JavaScript ontransitionend Event
The ontransitionend
event occurs when a CSS transition has completed.
Note: The ontransitionend
event will not fire if the CSS transition is removed before completion.
ontransitionend Event as Attribute
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<head>
<style>
h2{
color: blue;
padding: 0px;
-webkit-transition: padding 1s; /* For Safari 3.1 to 6.0 */
transition: padding 1s;
}
h2:hover {
color: green;
padding: 30px;
}
</style>
</head>
<body>
<h2 ontransitionend="myFunction()">Hover me and go</h2>
<p id="point"></p>
<script>
function myFunction() {
document.getElementById("point").innerHTML="Transistion Ended";
}
</script>
</body>
</html>
Syntax
As Attribute
<element ontransitionend = "JavaScript">
As Property
object.ontransitionend = function(){
// code
};
Using Event Listener
object.addEventListener("transitionend" , myScript);
Reminder
Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in JavaScript.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.