简体   繁体   中英

functions not working in proper order of ios5 iPad

I have a set of functions that are supposed to be working onclick, and then a few more that are binded to html5 video events. It works fine when I test it in Chrome, but when I try it in ios, it doesn't. It loads the video before it removes it from the screen.

JS :

$(document).ready(function () {
    $('#MyT').fadeOut();
    <!--$('#myVid').addClass('move');

    $('li, .thumbs').bind('click', function() {
        $("#bigPic").removeClass('move');

        var numb = $(this).index(),
            videos = ['images/talking1.m4v', 'images/talking2.m4v', 'images/talking1.m4v', 'images/talking2.m4v', 'images/talking1.m4v', 'images/talking2.m4v'],
            myVideo = document.getElementById('myVid');
            myVideo.src = videos[numb];
            myVideo.load();
        setTimeout(function(){
            myVideo.play();
        }, 200);
    });

    $('#myVid').bind("loadeddata", function() {
        $('#bigPic').addClass('move').delay(200);
    });


    $('#myVid').bind("playing", function() {
        ("#myVid").removeClass('move');

    });

    $('#myVid').bind("ended", function () {
        $("#bigPic").removeClass('move');
    });
});
});

CSS :

#bigPic {
    position:absolute;
 /* margin-left:-8px;   
    margin-top:-16px; */
    height:768px;   
    width:1024px;
    left:1200px;
    oveflow: hidden;    
}

.move {
    -webkit-transform: translateX(-1200px);
}

Edit I found out that the removeClass in the .bind('click') in the begining is not actually doing anything...

jQuery.click() doesn't function properly on iOS. I suspect that you're having the same problem with bind().

You might be able to use jQuery.on() or by using other events like touchstart

I saw this post which seems to be similar to your problem

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