开发者

jQuery 'document', 'body' and 'html' selectors not working on iPhone

开发者 https://www.devze.com 2023-04-12 07:02 出处:网络
I need to run a function when you click anywhere on the page.开发者_C百科 Initially I used this:

I need to run a function when you click anywhere on the page.开发者_C百科 Initially I used this:

$('html').click(function() {
    // stuff to happen
});

This works perfectly in my android phone and in firefox, but doesnt work on iPhones. Ive tried changing 'html' to 'body' and 'document' but still no luck.

Is there a proper iPhone way to use anything as a selector? I guess I could use '*' but I dont want the overhead as this is a mobile optimised site. Thanks


Have you tried $('body').click(function() { … ?

0

精彩评论

暂无评论...
验证码 换一张
取 消