Home › Forums › JavaScript › Your best snippets › Reply To: Your best snippets
December 6, 2016 at 5:12 pm
#248734
Shikkediel
Participant
Let me give that a virtual thumbs up for neatness, as to not clutter the thread with green banners. And then add this feature test for transition
support I’ve recently fiddled together. It will also select the correct event to use for transitionend
.
var pulse = 'TransitionEvent' in window ? 'transitionend' : 'WebKitTransitionEvent' in window ? 'webkitTransitionEnd' : '';
Usage:
if (pulse) {
target.addEventListener(pulse, function() {
// do stuff on transitionend
});
});
}
I think it’s valid to use these days but slightly discriminates against early versions of Opera.