简体   繁体   中英

javascript click function does not work properly in ios

I started a video project. I wrote my video player myself. I'm using javascript, jquery, asp.net and c #.

I made the video stop in seconds that the user set and the user asked questions to come to the screen. The video stops. The question is coming. Clicking an answer option. The clicked option is saved in the database (for analysis).

I send my data to the server side via ajax. It works perfectly when you answer questions instantly.I bring my questions to the screen with the css I created with Z-index.

Chrome, Edge and Android waiting for a certain period of time I encounter this problem.

My project is not working properly on ios. It brings the first question to the screen 3-4 times. But it makes the other questions show in one click.another questions bring to screen not problem. I just have a problem with the first question on ios. I can't understand why the question comes to the screen 3-4 times.

Html Code

<div id="v_area">
    <div id="my_ad">

        <p>
            <div class='clickable-div-1' id="div1">
                <button id="c1"></button>
            </div>
        </p>
        <p>
            <div class='clickable-div-2' id="div2">
                <button id="c2"></button>
            </div>
        </p>
        <p>
            <div class='clickable-div-3' id="div3">
                <button id="c3"></button>
            </div>
        </p>
        <p>
            <div class='clickable-div-4' id="div4">
                <button id="c4"></button>
            </div>
        </p>

    </div>
</div>    

javascript code

$(document).on('click', '.clickable-div-1', function() {

v.currentTime += 0.03;
document.getElementById("my_ad").style.visibility = "hidden";

var user = {};

user.Cevap1 = document.getElementById('c1').innerHTML;
var VKodu = document.getElementById('VKodu').innerHTML;
var SoruKodu = document.getElementById('SoruKodu').innerHTML;

$.ajax({
        type: "POST",
        `
        url: "VideoPlayerDemo.aspx/SonucKaydet", 
 data:'{user:'+JSON.stringfy(user)+',VKodu:'+JSON.stringfy(VKodu)+',SoruKodu:'+JSON.stringfy(user)+'}',

        contenttype:"json",
        success:function(data){        
                    if(document.getElementById("my_ad").style.visibility!="hidden")
{
  document.getElementById("my_ad").style.visibility ="hidden";`
    }

},
}),
}),
v.play();
});

一些苹果产品会阻止点击事件等虚拟点击事件

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