HTML DOM TransitionEvent propertyName Property

HTMLWeb DevelopmentFront End Technology

The HTML DOM TransitionEvent propertyName property returns a string corresponding to a CSS property used for transition when a transition event is triggered.

Following is the syntax −

Returning CSS property that transition has used −

transitionEvent.propertyName

Let us see an example of TransitionEvent propertyName property −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>TransitionEvent propertyName</title>
<style>
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   * {
      padding: 2px;
      margin:5px;
   }
   input[type="button"] {
      border-radius: 10px;
   }
   #playArea {
      display: inline-block;
      border-radius: 50%;
      background-color: #DC3545;
      width: 50px;
      height: 50px;
      border: 3px solid #AC3509;
      transition: all 1.3s ease;
   }
   #playArea:hover {
      transform:translateX(80px);
   }
</style>
</head>
<body>
   <form>
      <fieldset>
         <legend>TransitionEvent-propertyName</legend>
         <div id="playArea"></div>
         <div id="divDisplay"></div>
      </fieldset>
   </form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var playDisplay = document.getElementById("playArea");
   function getPropertyName(event) {
      divDisplay.textContent = 'CSS Property Used for Transition: '+event.propertyName;
   }
   playDisplay.addEventListener("transitionend", getPropertyName);
</script>
</body>
</html>

Output

Before hovering over the div element −

After hovering over the div element −

raja
Published on 30-Oct-2019 10:30:35
Advertisements