How do I make a JQuery Slider-like feature on iPhone/Android web app?

ぃ、小莉子 提交于 2019-12-20 09:59:50

问题


In the iPhone or Android, if you have a JQuery Slider, it doesn't quite work (touchscreen will move the screen instead of drag the slider.)


回答1:


You may need to write this from scratch. Luckily, @ppk has coded up an example of drag and drop for iPhone.




回答2:


Listen for touch events and move the slider accordingly. These events also work on Android as it also uses WebKit.




回答3:


You can use this library http://touchpunch.furf.com/ This provides touch events for all the jquery ui elements.




回答4:


I found sample code online which converts touch events to mouse events. I tested this with jquery-ui's slider and it worked nicely!

Link to source




回答5:


You can do this for iphone, android and windows phones via jquery+javascript. Windows phone with IE has one flaw, I have not been able to get it to snap to div sections.




回答6:


I used this to wire up http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ the slider. Works like a charm, just be sure to replace the code that works against specific dom elements. Then add $('#sliderdiv').addTouch (). Works on IPhone, but doesn't work for Android. According to quirksmode touch events don't work on Android.



来源:https://stackoverflow.com/questions/2422022/how-do-i-make-a-jquery-slider-like-feature-on-iphone-android-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!