Link to home
Start Free TrialLog in
Avatar of Refael
RefaelFlag for United States of America

asked on

HTML5 Video currentTime

Hello Experts,

I am trying to add an event listener "currentTime" when the video is playing so I can add/remove css styles to the relevant buttons e.g. #titlestadt.
How can I add it to my current script? Thanks!!!

var titlesVideo = $('#intro')[0];	
	
	$("#titlestadt").mouseover(function() {		
		titlesVideo.currentTime = 0;
		$("#intro").addClass("playing");
		titlesVideo.play();		
	}).mouseout(function() {
		$("#intro").removeClass("playing");	
	});
	
	$("#titleland").mouseover(function() {		
		titlesVideo.currentTime = 6;
		$("#intro").addClass("playing");
		titlesVideo.play();
	}).mouseout(function() {
		$("#intro").removeClass("playing");		
	});
	
	$("#titlefluss").mouseover(function() {		
		titlesVideo.currentTime = 10.5;
		$("#intro").addClass("playing");
		titlesVideo.play();
	}).mouseout(function() {
		$("#intro").removeClass("playing");		
	});

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Refael

ASKER

Hello Chinmay. I wrote to you on the chat. Thank you for your solution and sorry for such a late reply.
No worries. Take Care Refael.