简体   繁体   English

javascript点击功能在ios中无法正常工作

[英]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 #.我正在使用 javascript、jquery、asp.net 和 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.我通过ajax将我的数据发送到服务器端。 It works perfectly when you answer questions instantly.I bring my questions to the screen with the css I created with Z-index.当您立即回答问题时,它可以完美运行。我使用我用 Z-index 创建的 css 将我的问题带到屏幕上。

Chrome, Edge and Android waiting for a certain period of time I encounter this problem. Chrome、Edge 和Android 等了一段时间我就遇到了这个问题。

My project is not working properly on ios.我的项目在 ios 上无法正常工作。 It brings the first question to the screen 3-4 times.它将第一个问题带到屏幕上 3-4 次。 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.我只是对 ios 上的第一个问题有疑问。 I can't understand why the question comes to the screen 3-4 times.我不明白为什么这个问题出现在屏幕上 3-4 次。

Html Code html代码

<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 javascript代码

$(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();
});

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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