使用Javascript模仿原生滚动 [英] Mimic native scrolling using Javascript

查看:116
本文介绍了使用Javascript模仿原生滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用哪些Javascript库来模仿IOS设备上的原生滚动行为(mainky iPad)即使是基于jQuery的库也没问题。

Which Javascript libraries can be used to mimic the native scrolling behavior on an IOS device (mainky iPad) Even jQuery based libraries would be fine.

在你说之前,我知道最常见的是iScroll https://github.com/cubiq/iscroll
但我想知道更多...

Also before u say, I know the most common is iScroll https://github.com/cubiq/iscroll But i want to know more...

请尽可能多地列出。谢谢你。

Please list as many as you could. Thank u.

推荐答案

Scrollability是最近开发的一种实现方法,可以很好地模仿iOS设备上的原生滚动。但是,他自己承认正在进行中并且还没有为生产使用做好准备。

Scrollability by Joe Hewitt is a recently-developed implementation that does a pretty good job of mimicking the native scrolling on iOS devices. However, it is by his own admission a "work-in-progress" and not ready for production use.

此外,iOS 5将通过以下方式提供直接的原生滚动支持 -webkit-overflow-scrolling:touch CSS属性和值。在元素上设置 overflow:scroll 将使滚动行为像在本机应用程序中滚动面板一样:一根手指,原生风格的动量和行为。基本上所有需要大量JavaScript的东西都可以用两个CSS属性替换。

Additionally, iOS 5 will have direct native scrolling support via the -webkit-overflow-scrolling: touch CSS property and value. Setting that along with overflow: scroll on an element will make scrolling behave like scrolling a panel in a native app: one finger, native-style momentum and behavior. Basically everything that takes a good chunk of JavaScript can be replaced with two CSS properties.

缺点是,由于它只在iOS测试版中,你仍然需要使用脚本作为后备,直到iOS 5是主流 (不仅仅是发布),Android采用它(并且该版本成为主流),等等。我们需要一段时间的回退。

The downside is that since it is only in the iOS beta, you still have to use a script as a fallback until iOS 5 is mainstream (not just released), Android adopts it (and that release becomes mainstream), etc. We will need a fallback for a good while yet.

你可以获得更多细节在 FunctionSource 此博客。同样,这在今天没有用,但在接下来的6到12个月内有用(对于其他平台可能更长)。

You can get more details at FunctionSource and this blog. Again, this isn't of use today but will be useful in the next 6 to 12 months (possibly longer for other platforms).

这篇关于使用Javascript模仿原生滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆