Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Touch events are not triggered on video tags on safari for iPhone

I want to prevent the scrolling on a safari web page for iphone by binding the preventDefault method on the document element of the DOM, and it works on every elements but the video tag.

document.addEventListener("touchmove", function(e){e.preventdefault();}, false);

I've tried attaching the event to the video tags, but it seems as if nothing is attached or the events are simply not triggered.

like image 299
Stef Avatar asked May 20 '10 13:05

Stef


1 Answers

In my test, when ommiting the "controls" attribute of the video you can get the events....

By example....

<video src="http://192.168.1.53/videoTester/Cuatro.mp4" id="player" width="100%" height="100%" x-webkit-airplay="allow" ></video>

Then put a div in top... and it works for me....

like image 174
xperiments Avatar answered Oct 12 '22 09:10

xperiments