Jquery点击不使用ipad [英] Jquery click not working with ipad

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

问题描述

我们有一个Web应用程序,它使用Jquery blockUI来打开弹出窗口并执行一些操作。所有这一切在Safari上运行良好,IE 8问题在于Ipad。弹出窗口中没有任何操作正在响应。它只停留在那个页面上。即便关闭也行不通。
我们还需要添加其他东西吗?
这里是打开页面并单击事件以进行关闭的代码。

we have a web application which is using Jquery blockUI to open a pop up and do some action. All of this works fine on Safari, and IE 8. problem is with Ipad. none of the actions in pop up are responding. it just stays on that page. even close doesnot work. do we need to add anything else? here is the code that opens a page and click event for close.

<script>
$(document).ready(function() {
  $.ajaxSetup( {
           cache:false
   });

        $("#sendInviteDiv").load("invite.htm?action=view&pid="+pid);
            $.blockUI({ message: $('#sendInviteDiv'),
                centerY: 0,
                    css: {
                top:  ($(window).height() - 550) /2 + 'px',
                        left: ($(window).width() - 870) /2 + 'px',
                        width: '870px'
                }
            });
            //var ua = navigator.userAgent;
            //var event = (ua.match(/iPad/i)) ? "touchstart" : "click";
            //alert(ua);

            $('#closeInvite').click($.unblockUI);

    $('#inviteBtn').click(function() {
//script to load 
       //setPositionDetails('${formName}','inviteBtn');

       });
}


});


</script>

感谢指针。

javascript已转为在Ipad Safari设置中允许使用on和popup。

javascript is turned on and popups are allowed in Ipad Safari settings.

推荐答案

我通常使用

.bind("click touchstart", function(){

});

而不是:

.click(function(){

});

这样你就可以绑定正确的事件了。它也更快,由于某种原因,触摸响应速度比点击快得多。

That way you are binding the the correct event. It's also quicker, the touch responds much faster than click for some reason.

这篇关于Jquery点击不使用ipad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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