benhowdle89 / touche

Effortlessly re-map click events to touch events on touchscreen UIs
http://benhowdle.im/touche
MIT License
605 stars 49 forks source link

Touche.js

Effortlessly re-map click events to touch events on touchscreen UIs

Full docs →

Touche(NodeList/Node).on('click', function(){ // handler })

Usage

<!-- somewhere before the rest of your JavaScript code -->
<script type="text/javascript" src="https://github.com/benhowdle89/touche/raw/master/path/to/touche.js"></script>

Examples

// applying a click event to one element

Touche(document.querySelector('#myButton')).on('click', handleClick);

// or to multiple at once

Touche(document.querySelectorAll('.myButtons')).on('click', handleClicks);

// or with jQuery

$('.myButtons').on('click', handleClicks);