简体   繁体   English

JavaScript平滑滚动-iPhone

[英]JavaScript smooth scroll - iphone

Are there any plugins or does anyone know of a good way to achieve the iPhone elastic band scroll? 是否有插件或没有人知道实现iPhone松紧带滚动的好方法? working example in flash http://www.shinedraw.com/text-effect/silverlight-3-and-flash-iphone-dragging-effect/ Flash中的工作示例http://www.shinedraw.com/text-effect/silverlight-3-and-flash-iphone-dragging-effect/

I'm looking to drag and scroll a div, but if it goes past a certain point it bounces back. 我想拖动和滚动一个div,但是如果它超过某个点,它就会反弹。

Thanks 谢谢

查看iScroll

Once you have figured out how to scroll it, it's very simple in mootools to obtain that "bounce" effect. 一旦弄清楚了如何滚动,在mootools中获得“反弹”效果非常简单。

For example, you can apply a particular bounce effect in this way: 例如,您可以通过以下方式应用特定的弹跳效果:

//element is supposed to be the main div you want to drag on iPhone
var element = $('elementID');

//instantiate a morph fx referred to that element
var bounceEffect = new Fx.Morph(element,{duration:1000, transition:Fx.Transitions.Bounce.easeOut});

//...then, when you want it to bounce back (e.g. at the release, or when it goes below a certain position) you can do:

bounceEffect.start({'top':0});

Edit: take a look @ mootouch too, it's a very interesting project 编辑:也看看@ mootouch ,这是一个非常有趣的项目

德鲁麦科马克写了一篇文章为MacResearch有关的弹跳和滚动势头的物理位置 ,其中包括复制多少你在iPhone上看到的行为的JavaScript代码。

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

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