简体   繁体   English

使用iScroll 4将最后一个元素滚动到第一个元素的开始位置

[英]using iScroll 4 scroll the last element to the start position of first element

I am now using iScroll 4 from http://cubiq.org/iscroll-4 to enable scrolling in touch devices.The problem is that the last element is not coming proper. 我现在正在使用http://cubiq.org/iscroll-4上的iScroll 4来启用触摸设备中的滚动。问题是最后一个元素不合适。 I want the last element to scroll till the start position of the scroll. 我希望最后一个元素滚动到滚动的开始位置。 I am not understanding how to make it work. 我不了解如何使其工作。 The last element is not coming to the center of the screen width. 最后一个元素未到达屏幕宽度的中心。 I have positioned the first element to the center of screen. 我已经将第一个元素定位到屏幕的中心。 Thanks in advance for any help. 在此先感谢您的帮助。

We just need to do (Screen width - Element width) + (Number of elements*Element width) to bring the last element to the start position of the scroll. 我们只需要执行(Screen width - Element width) + (Number of elements*Element width)即可将最后一个元素移到滚动的开始位置。 Here in my case center of the screen. 以我为例,在屏幕的中心。

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

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