繁体   English   中英

IOS上的ontouch代码与Android touch和Windows touch上的代码不同吗?

[英]ontouch code on IOS is not the same as on Android touch and windows touch?

我使用此代码是因为它可以在您滑过div框时打开div框和div框上的阴影。

if (!("ontouch" in document.documentElement)) {
    document.documentElement.className += " no-touch";
}
$('html').on('touch touchend', function(e) {
        $(this).toggleClass('over');
});

但是我注意到,在三星银河5上,它的工作不如在iPhone上好。

使用iPhone时,它只能在其上滑动。 但是在Windows触摸手机上的android上,您实际上必须稍微按一下才能产生相同的效果。 有没有办法解决这个问题?

如果您同时拥有两部手机,都可以在我的网站https://www.gester.nl上对其进行测试。

预先感谢您的回答。

来自荷兰的问候。

jQuery可以解决大多数此类跨浏览器的问题-使用它就可以使用它。此外,您可能是指ontouchstart而不是ontouch

if (!("ontouchstart" in document.documentElement)) {
    $(document.documentElement).addClass("no-touch");
}
$('html').on('touch touchend', function(e) {
    $(this).toggleClass('over');         
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM