触摸时平移元素 - jQuery
我正在尝试在触摸时平移元素,我使用以下方法来计算用户滑动的距离(并在滑动初始化后添加转换/功能)我如何获得滑动的实时值并为 DIV 制作动画跟着手指走?
我使用以下代码来实现滑动功能:
I am trying to pan elements on touch, i am using the following to calculate the distance the user has swiped (and add transitions / functions after a swipe has initialised) How would i get the real time values of the swipe and animate say a DIV to follow the finger along ?
I am using the following code to achieve the swipe functionality:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要对脚本进行一些分解才能实现您需要的功能。基本上你所拥有的是将“滑动”保存到单个事件,你需要捕获类似这样的 touchMove 事件:
无论如何应该是类似的东西,但还没有测试它。
you need to take the script apart a bit to achieve the functionality you need. basically what you have there is saving the "swipe" to a single event, you need to capture the touchMove event something like this:
should be something like that anyway, havnt tested it though.