OnClick在Ios11上不起作用 [英] OnClick not Working on Ios11

查看:70
本文介绍了OnClick在Ios11上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了ios 11之外,我可以在任何设备上使用以下功能,并且不知道为什么,我尝试了一些在这里找到的解决方案,但是它不起作用,例如:更改选择器,添加"cursor:pointer"样式,在该函数之前设置一个空的onclick,但没有成功.

I have the following function working on any devices except ios 11 and don't know why, I have tried some solutions found here but it doesnt work, like : change the selector, add 'cursor:pointer' style, set an empty onclick before the function, without success.

知道为什么发生这种情况(或不发生)

Any idea why its this happening (or not happening),

这是js代码

    $('#buy-mobile-buttons-section').delegate('.buy-button', 'click', function(data) {
    alert('E');
    var $self = $(this);
    addToCart($(this), function(data){
        if (data > 0){
            addGMTAddToCart($self);
            var url = Routing.generate('pcc_cart_detail');
            $(location).attr("href", url);
        }
    });

});

这是HTML

<button type="button" data-loading-text="Añadiendo..." id="js-buy-button-mobile" class="btn btn-primary btn-lg buy GTM-addToCart buy-button"
    data-name="Asus K541UA-GO1205T Intel Core i7-7500U/8GB/1TB/15.6&quot;" 
    data-id="134853" data-price="633.49" data-brand="Asus"
    data-category="Portátiles" data-qty="1">
    <strong>Buy</strong>
    <i class="pccom-icon">]</i>

我希望你能理解,我的英语不是这里最好的

I hope you can understand it, my english is no the best arround here

推荐答案

尝试使用jquery绑定功能.

Try jquery bind function.

例如:

$( "#foo" ).bind( "click", function() {
    alert( "User clicked on 'foo.'" );
});

这篇关于OnClick在Ios11上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆