HI, i was wondering if it was possible to add a listener to a where in the time line a video is then add class to another element…i.e i have a looping mp4 (duration 13 secs)…every at 10 secs add class to another div (then the css class will loop every 13 secs)
Thanks, however not as comprehensive as your suggestion somewhere on the lines of:
document.getElementById(‘my-video’)
If my-video play position = 10 secs
$(‘.div’).addClass(‘animate’);
as the video is in a loop, id just need to fire the addclass once (at 10 secs) for the 13 sec clip…then i could use my css duration (13 secs) to sync with the video for every 10 secs
Thanks…sorry for not getting back to you…got a little side tracked…i had a go at looping through the css animation to match the video timeline and unfortunately, as you flagged up before, i did lose sync after a while…so…rethinking, using your initial code, is it possible to add a class/toggle each of the progress child divs when the video hits 1.48 secs (rather than splitting into 10ths)?
Sure… actually, putting the fixed value of 10 in the code wasn’t ideal indeed; better would be progressMarks.length, so that the JS stays agnostic about how many marks there actually are and you can change the markup at any time without having to adjust the JS: