Hammer.js is a JavaScript library for adding touch gestures support to any website so that users can interact with them easier on touch devices.

Hammer.js

It requires jQuery, only 2kb sized and supports tap, double tap, hold, drag and transform. The library is implemented pretty easily:

  • just bind Hammer.js to a container HTML element
  • every touch event performed on that element returns a callback with an array of details including:
    • event
    • position
    • touches
    • scale
    • rotation

For drag gestures, it can also return extra info like the angle, direction and distance.

Hammer.js works `almost` on all modern browsers and, to sum up, “you can touch this”.

Requirements: jQuery

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

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

5 × five =

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like

Detect screen size with jQuery and apply a CSS style

Sometimes we need to format the content differently according to the screen resolution of the user. One of the ways to do this is to simply detect the screen width using the screen.width property and change the stylesheet.

jQuery: Setting cookies

Setting and clearing cookies with jQuery is really easy but it's not included in the jQuery core and requires a plug-in. This post shows how to set, get the value of and clear cookies with jQuery.