简体   繁体   中英

Have to fire click event twice to trigger full screen mode on ipad

I have a click event that calls the following code:

$('#video-overlay').on('click', '.media-thumb', function(e){
        $('.video-file')[0].play();
    $('.video-file')[0].webkitEnterFullscreen();
    e.preventDefault();
    });

In my chrome browser this works fine but on ipad i have to click .media-thumb twice to actually get to fullscreen mode, testing on ipad2 v:iOS5. Can anyone offer some light on how I can resolve this so .play() and .webkitFullscreen() get called together?

Have you tried using touchstart?

$('#video-overlay').on('click touchstart', '.media-thumb', function(e) {
    e.preventDefault();
    $('.video-file')[0].play();
    $('.video-file')[0].webkitEnterFullscreen();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM