综合编程

Which JavaScript-based library can be recommended for a carousel-like swipe experience?

微信扫一扫,分享到朋友圈

Which JavaScript-based library can be recommended for a carousel-like swipe experience?
0

I’d like to create a carousel-like swipe experience for mobile touch devices based on JavaScript for iOS, Android and WP8 that’s easy to use and fulfills all my requirements.

So far I tried these plugins but none of them really convinced me:

  • TouchSwipe (Too complicated)
  • SwipeView (Has problems if swiped fast)
  • iScroll (No WP8 support)

Thus I’m looking for a good JS library which can fullfill these requirements:

  • Must be able to swipe all kind of contents, not only images. E.g. I want to be able to pass it an array of


    elements and the plugin should take care of them and make them horizontally swipeable.
  • The plugin must
    work for iOS 4.x+, Android 2.2+ and Windows Phone 8.
  • It should be as small (in terms of kilobytes) and lightweight as possible.
  • It should be performance-optimized. E.g. if I passed 20 div elements with lots of inner content, the library should be smart enough to hide non-visible items and swipe only the divs that matter (the ones that are visible).
  • Swiping should be smooth and if the user releases the screen the swiped element should snap to the borders of the parent element so that only 1 element is visible at a time.

Is there a library which can be recommended?

Problem courtesy of: Timo

Solution

Looking at your requirements I can recommend Hammer.js I have used it on a few similar projects and its nice and small only around 3kb minified. Its pretty easy to extended and modify to your exact requirements, as I don’t think anything off the shelf will work exactly to what you need.

http://eightmedia.github.com/hammer.js/

Also a quick note from experience play around with the default settings to get te right sensitivity and motion range that you want.

Solution courtesy of: Dominic Green

阅读原文...


微信扫一扫,分享到朋友圈

Which JavaScript-based library can be recommended for a carousel-like swipe experience?
0

CSS3 Recipes

为什么微软不会推出Android手机?

上一篇

JSON_MERGE_PRESERVE() – Merge Multiple JSON Documents in MySQL

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Which JavaScript-based library can be recommended for a carousel-like swipe experience?

长按储存图像,分享给朋友