vash15 / backbone.touch

Enable faster click events on touch devices for Backbone views

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backbone.touch

Monkey patch Backbone.View to enable fast tap events on touch devices.

Usage

Backbone.touch is made to work with your existing views. It replaces the delegateEvents method and replaces any click event with the three events touchstart, touchmove and touchend when a touch device is used. Once the touchend fires your callback is executed without the 300ms delay that the click event has.

Download & Include

Bower install

bower install backbone.touch

Manual download

Depends on Underscore, Backbone and jQuery. You can swap out the jQuery dependency completely with a custom configuration.

Include in your application after jQuery, Underscore, and Backbone have been included.

<script src="/js/jquery.js"></script>
<script src="/js/underscore.js"></script>
<script src="/js/backbone.js"></script>

<script src="/js/backbone.touch.js"></script>

Note that backbone.touch currently overwrites Backbone.View to make its usage a no-op part from including it.

Release notes

0.4.3

  • New feature touchActiveClassName. If the property is valued sets a CSS class to the current item.

0.4

  • NodeJS + Browserify environment support

0.3

  • Possibility to override the threshold
  • Grunt v4.0

0.2

  • Register as an anonymous AMD module

0.1

  • Initial release. Only tested on iPad

License

MIT License (c) Raymond Julin

About

Enable faster click events on touch devices for Backbone views


Languages

Language:JavaScript 65.5%Language:HTML 34.5%