Drag to change image slide with jquery like in iphone

esafwan picture esafwan · Aug 1, 2011 · Viewed 7.4k times · Source

Am using supersized jquery plugin for my site. It comes with button for next and previous slides. I want to implement drag to change feature in it. If some one click and move mouse to right it should act as the next slide button.

But how can i do it with jquery? How can i know when user click n drag to left/right

http://buildinternet.com/project/supersized/

Answer

Semyazas picture Semyazas · Aug 1, 2011

jQuery recognizes mouseUp, mouseDown and mouseMove as events.

You would have to capture the mouseposition on mouseDown, update the position while it's moving and compare that to your initially captured position. While this is highly theoretical, check here Recreate Iphone Swipe effect using jQuery for a live example.