简体   繁体   English

无法在iPad上滚动网页

[英]Cannot scroll web page on iPad

On iPad I cannot scroll a web page. 在iPad上,我无法滚动网页。 It works fine in Safari, Chrome and Firefox on OS X. 它在OS X上的Safari,Chrome和Firefox中正常运行。

The page has an area in which content can be scrolled only horizontally. 页面上有一个区域,其中内容只能水平滚动。 It consists of a container div which has width = 100% and height = (100% - 40px). 它由一个容器div组成,其宽度为100%,高度为(100%-40px)。 I am setting the height by a JavaScipt function which is triggered by window resize events. 我正在通过JavaScipt函数设置高度,该函数由窗口调整大小事件触发。 Inside this container is another div with the width of the content (very wide, to avoid line breaks). 在此容器内是另一个div,其内容的宽度(非常宽,以避免换行)。 Inside that is the content. 里面就是内容。

CSS properties of the container are: 容器的CSS属性为:

overflow-x:scroll;
overflow-y:hidden;
white-space:nowrap;

See the page and full source code here: dcfoto.de 请在此处查看页面和完整源代码: dcfoto.de

On iPad, scrolling is not possible. 在iPad上,无法滚动。 What am I doing wrong? 我究竟做错了什么? By the way: resizing also does not work properly on orientation change. 顺便说一句:调整大小在方向更改上也无法正常工作。 Maybe that's connected. 也许已经连接了。

Unfortunately a two-finger swipe needs to be performed, and even then it is not responsive (when compared to the default one finger swipe scroll). 不幸的是,需要执行两指轻扫,即使那样,它也没有响应(与默认的一指轻扫滚动相比)。

There are quite many javascript solutions out there, (sencha touch and iscroll being the most promising and advanced) 有很多javascript解决方案,其中(sencha touch和iscroll是最有前途和最先进的)

I would recommend http://cubiq.org/iscroll-4 which is hands down the coolest touch-scroll script out there. 我建议使用http://cubiq.org/iscroll-4 ,它是最酷的触摸滚动脚本。 It also works for android, but quite more sluggishly since the default android browser albeit webkit based doesnot support css3 3d accelerated properties as good as the mobile safari one. 它也适用于android,但由于基于Webkit的默认android浏览器不支持css3 3d加速属性(与移动Safari一样好),因此速度较慢。

If I were you I would check for the user agent of the user, and deploy that script for android and ipad/iphone users. 如果您是我,我将检查用户的用户代理,并为android和ipad / iphone用户部署该脚本。

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

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