简体   繁体   English

在iPad上滚动动画到下一个div?

[英]On scroll animate to next div on iPad?

I have been trying to search for different things, but I couldnt find the suiting solution for my problem. 我一直在尝试寻找不同的事物,但是找不到适合我问题的解决方案。

I need to scroll to the next div, when you swipe up on the iPad, so the div's top snaps to the ipads top. 在iPad上向上滑动时,我需要滚动到下一个div,因此div的顶部将与ipad的顶部对齐。 I think this would be simply on .scroll in combination with .scrollTop() , right? 我认为这将是根本on .scroll结合.scrollTop()对不对? So now when you scroll, it should detect either you scroll down or up, and when you do so, jump to the next or previous div. 因此,现在滚动时,它应该检测到向下或向上滚动,并且当您滚动时,跳到下一个或上一个div。

Has anyone a ressource, where I can find a solution to this? 有没有人可以提供解决方案的资源?

Thanks in advance 提前致谢

I've done the exact same thing a while ago for my Personal Website . 不久前,我已经为我的个人网站做过同样的事情。 (if you check it with a tablet or a smart phone you can see it in action) (如果您使用平板电脑或智能手机进行检查,则可以看到它的运行情况)

what I used was: 我使用的是:

  1. jQuery Mobile : to detect touch moves and unbind the scroll jQuery Mobile检测触摸动作并取消滚动
  2. Touch Swipe Plugin : to detect the direction of swipe 轻触滑动插件检测滑动方向
  3. And the rest is simple jQuery animation using scrollTop() and offset() 其余的是使用scrollTop()offset()简单jQuery动画

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

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