html - How do I prevent video playback when <video> was tapped during scrolling with overflow-scrolling:touch on? -
i use -webkit-overflow-scrolling:touch
within overflowing div container. within container have <video>
element.
on iphone, when scroll down, tap scrolling view in order stop it. no problem, if hit link. browser understands wanted stop scrolling , not open link.
the problem here if hit play button of video accidentally, playback starts not intended. how can fix this?
demo (open on iphone!): http://www.timo-ernst.net/misc/scrollvideo/
full source code:
<!doctype html> <html> <head> <title>scroll video test</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <style> *{ padding:0; margin:0; } html, body{ height: 100%; width: 100%; } .scrollarea{ height:100%; -webkit-overflow-scrolling: touch; overflow-y:scroll; } #video{ width: 100%; } </style> </head> <body> <div class="scrollarea"> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> scroll down video<br> <video id="video" src="http://video.golem.de/download/15799?q=medium&rd=rlmob_nojs" controls="1" poster="http://video.golem.de/teaser/1/1/15799/medium-480-regatta-snap.jpg" x-webkit-airplay="allow" preload="none"></video> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video<br> scroll video </div> </body> </html>
Comments
Post a Comment