Transition events

function removeTransition(e) {
    if (e.propertyName !== 'transform') return;
    e.target.classList.remove('playing');
  }

I don’t understand this code would you please explain it to me step by step especially the code inside the function.
Thank you in advance.

function removeTransition(e) {
    // e is an event
    // if e.propertyName does NOT equal 'transform' then do nothing
    if (e.propertyName !== 'transform') return;

   //  else remove the class "playing"  from the target element (e)
    e.target.classList.remove('playing');
  }

another way it could be written is this:

function removeTransition(e) {
    // e is an event
    // if e.propertyName DOES equal 'transform'
    if (e.propertyName == 'transform') {
        // then remove the "playing" class from the target element
        e.target.classList.remove('playing');
    }
}
1 Like

This is a pretty simple function so I’m guessing you understand at least some of it. Please be very specific about what you don’t understand. That way we know exactly what to explain.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.