Iphone点击事件的位置固定

时间:2017-01-11 09:51:53

标签: jquery iphone click fixed

我有问题,我在位置上修复了元素,点击后启用模态: Here is demo

JS:

$(document).on('click', '.open', function(){
    $(this).toggleClass('active');
});

$(document).on('click', '.modal, .modal-close', function(){
    $('.open').removeClass('active');
});

$(document).on('click', '.modal-content', function(e){
    e.stopPropagation();
});

点击圈我用jquery打开modal,在android上运行正常,但iPhone不检测点击事件。我怎么修这个?

1 个答案:

答案 0 :(得分:0)

<强> Updated fiddle

尝试将touch也添加到活动中:

$(document).on('click touch', '.open', function(){
    $(this).toggleClass('active');
});

$(document).on('click touch', '.modal, .modal-close', function(){
    $('.open').removeClass('active');
});

$(document).on('click touch', '.modal-content', function(e){
    e.stopPropagation();
});

并尝试将cursor:pointer添加到open元素:

.open{
    cursor:pointer;
}

或者来自js代码:

$('.open').css('cursor','pointer');

希望这有帮助。