Add class to after video play
by Max Belov
HTML
<video id='myVID' class='' width="320" height="240" controls>
<source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4" />
<source src="http://www.w3schools.com/html/movie.ogg" type="video/ogg" />Your browser does not support the video tag.</video>
CSS
.MyClass {
border: 10px solid blue;
}
JavaScript
(function () {
var video = document.getElementsByTagName("video")[0];
video.addEventListener('play', function (e) {
console.log('playing');
if (this.className.indexOf('MyClass') == -1) this.className += " MyClass";
else
console.log('has class');
});
})();