简体   繁体   English

在iScroll4中无限滚动或改善惯性/动量

[英]infinite scrolling in iScroll4 or improve inertia/momentum

I've been trying to get this figured out for a few months now and have exhausted everything I can think of. 我一直想把这个问题弄清楚几个月,并且已经用尽了我能想到的一切。

What I'm trying to achieve is: http://blue.bluestudios.kenzomedia.com/v0.7/ (some logic borrowed from iScroll4) 我想要实现的是: http ://blue.bluestudios.kenzomedia.com/v0.7/(从iScroll4借来的一些逻辑)

Notice that you can keep scrolling. 请注意,您可以继续滚动。 This works fine in that example. 在这个例子中,这很好用。 The issue is that it's not completely smooth like iScoll4. 问题是它不像iScoll4那样完全顺畅。

So I've been trying to do the same using iScroll4 with blue.bluestudios.kenzomedia.com/v0.8/ but I can't seem to figure out how to get it to "repeat" correctly. 所以我一直在尝试使用iScroll4与blue.bluestudios.kenzomedia.com/v0.8/一样,但我似乎无法弄清楚如何正确地“重复”它。 It seems to be something with startX and startY but I've tried so many different pieces of code at this point and really can't think of anything else to do. 它似乎是startX和startY的东西,但我在这一点上尝试了很多不同的代码,真的想不出别的事情要做。 If you are simply moving your mouse/finger it will repeat with no issue. 如果您只是移动鼠标/手指,它将重复,没有问题。 It's only when animating. 这只是在制作动画时。

http://blue.bluestudios.kenzomedia.com/v0.8/assets/js/libs/iscroll.ext.js this is where I have the working _move function. http://blue.bluestudios.kenzomedia.com/v0.8/assets/js/libs/iscroll.ext.js这是我有工作_move功能的地方。

Again, tried to do the same in the animate function with no luck. 再一次,尝试在动画功能中做同样的事情,没有运气。

Any suggestions at this point would be extremely helpful. 此时的任何建议都会非常有帮助。 And this is for either figuring out how to get iScroll4 to do what I'd like or to improve the animation on v0.7. 这是为了弄清楚如何让iScroll4做我想做的事情或者改进v0.7上的动画。

I see that you have too many nested elements within your iscroll wrapper div. 我看到你的iscroll包装器div中有太多嵌套元素。 Remove all those div's that are not required. 删除所有不需要的div。 This degrades performance. 这会降低性能。 I just made a simple test by deleting some of the nested element in firebug and the performance improved immensely. 我只是通过删除firebug中的一些嵌套元素进行了一个简单的测试,性能得到了极大的改善。 As the documentation in http://cubiq.org/iscroll-4 try to keep the DOM structure as simple as possible, remove all the unnecessary tags and avoid too many nested elements . 正如http://cubiq.org/iscroll-4中的文档尽量保持DOM结构一样简单,删除所有不必要的标记并避免使用太多嵌套元素 I believe this will make your iscroll smooth once you try this out 我相信一旦你尝试这个,这将使你的iscroll顺利

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

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