在 iPad 上滚动

发布于 2025-01-07 18:55:07 字数 723 浏览 0 评论 0原文

我有下一个代码:

> <div class="scroller" style="width: 100%; height: 300px; overflow:
> auto; overflow-y: hidden;">
>     <div class="content" style="height: 100%; width: 2500px;">
>         <div id="vScrollDiv" style="width: 500px; height: 100%; overflow: auto; color: #fff; display: inline-block">
>             Content that makes div overflow verticaly
>         </div>
>         <div style="width: 1900px; height: 100%; color: #000; display: inline-block">
>             Content that makes "scroller" div overflow horizontaly
>         </div>
>     </div> 

当我的手指位于仅垂直滚动的 div 上并且我做出想要水平滚动的手势时,如何水平滚动内容 div?

I have the next code:

> <div class="scroller" style="width: 100%; height: 300px; overflow:
> auto; overflow-y: hidden;">
>     <div class="content" style="height: 100%; width: 2500px;">
>         <div id="vScrollDiv" style="width: 500px; height: 100%; overflow: auto; color: #fff; display: inline-block">
>             Content that makes div overflow verticaly
>         </div>
>         <div style="width: 1900px; height: 100%; color: #000; display: inline-block">
>             Content that makes "scroller" div overflow horizontaly
>         </div>
>     </div> 

How can I scroll horizontally the content div when my finger is over the div that scrolls only vertically and I gesture like I want to scroll horizontally?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薄荷梦 2025-01-14 18:55:07

我能够捕获触摸事件并通过识别“单击”div 并计算拖动轨迹来滚动右侧 div。
有关触摸事件的更多信息:
https://developer.apple.com/库/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
滚动是用以下方法制作的:
http://demos.flesler.com/jquery/scrollTo/

I was able to catch the touch events and scroll the right divs by identifying "clicked" div and calculating the trajectory of the drag.
More infos about the touch events:
https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
Scrolling made with:
http://demos.flesler.com/jquery/scrollTo/

故人的歌 2025-01-14 18:55:07

如果我正确地解释你的问题...你想用水平滚动来模拟鼠标滚轮。我猜这不是 ipad 的功能。如果你移动手指滚动到一个方向,如果可能的话它会这样做......但是当你溢出被隐藏时它会忽略它。我认为这对于某些网络代码来说是不可能的。我对这个问题的理解正确吗?

if i interpret your question right... you want to simulate the mousewheel with horizontally scroll. Thats not a feature of ipad i guess. if you move your fingers to scroll into a direction it will do that if possible... but as you overflow is hidden it will ignore it. i think this is not possible with some web-code. did i undestand that question right?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文