且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

引导弹出窗口不会在移动设备中关闭

更新时间:2023-11-23 08:12:34

问题是在 Iphone 上点击 body 元素不起作用.尝试编写一个简单的 html 页面,其中包含以下代码:$(函数(){$('body').on('click touchstart', function (e) {警报(点击");});});嗯,在 Iphone 上不会有任何警报.所以专注于此,我发现有一些解决方法.一种解决方法是在您想要点击的元素上设置一个 css-directive(在我的例子中是所有的 body-tag,所以在那个 cse 中,您可能想要放置一些包含所有 body-content 的包装器).该指令很简单:游标:指针;

The problem is that on Iphone onclick on the body element doesnt work. Try to code a simple html-page where you have this code: $(function () { $('body').on('click touchstart', function (e) { alert("clicked"); }); }); Well, on Iphone there will not be any alert. So focusing on that, I discovered that there are a few workaround to this. One workaround is to have a css-directive on the element you want to be clickable (in my case all the body-tag, so in that cse you may want to put some wrapper envolping all the body-content). The directive is simply: cursor:pointer;

由于您可能不希望所有元素都显示指针,因此您可能需要检测客户端是否为 iOS.

As you probably dont want all the elements to show the pointer, you probably will need to detect if the client was iOS.