GithubHelp home page GithubHelp logo

benhowdle89 / touche Goto Github PK

View Code? Open in Web Editor NEW
607.0 23.0 54.0 30 KB

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

Home Page: http://benhowdle.im/touche

License: MIT License

JavaScript 100.00%

touche's People

Contributors

alexdresko avatar andekande avatar benhowdle89 avatar jantimon avatar pvorb avatar ramana-chavakula avatar silverkorn avatar wmadden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

touche's Issues

jQuery implementation bug for touch PCs that have a mouse

When using the jQuery implementation of this library e.g.

// or with jQuery

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

The problem addressed in #2 still exists. A device with a mouse that is touch enabled registers both events and it appears to the user nothing is happening.

jQuery.on() and .off() have several unhandled overloads

Their signatures are:

.on( events [, selector ] [, data ], handler(eventObject) )
.off( events [, selector ] [, handler(eventObject) ] )

but touche.js only handles the trivial case where events is a single event name.

Problem cases:

  • events is a space-separated list of event names, possibly namespaced
  • events is an object, which causes our subsequent slice() call to explode

Some devices fire a click event anyway

I've noticed a very wide spread problem with touch events on some devices. It appears with every touch event library (like this one) I've tested so far as well as an own minimal solution.
It appears on the default Android browser for example, and does not appear on iOS and Chrome for Android.
It seems that an additional click event is fired right after the touch event. The problem is: the touch and the click event only share coordinates, not the tapped element.

This is a problem when you develop a "one page app" and you change the content by tapping an element. When a link appears at the exact spot where you tapped the screen that link gets triggered as well. I don't know what exactly happens, but this is, what it feels like and I don't know how to deal with this.
Does anyone know a solution to that problem?

This is not just a ask for help. If someone knows a solution it should be implemented into this script as well ;)

isTouch is TRUE for Desktop Firefox

var isTouch = 'ontouchstart' in window || 'msmaxtouchpoints' in window.navigator;

isTouch == true;

Tested on Firefox 40 & 41, Mac OSX Yosemite

Use touchmove to more accurately simulate clicking

Take a look at http://stackoverflow.com/a/25727560/3791179

The way the click event works is that if you start and end your click in the same place, the click event will fire. If you move between clicking down and releasing, it doesn't fire.

A touch even that emulates click should work the same way. If the user touchstarts and then touchmoves, the click event shouldn't be triggered. It should only be triggered if there's no movement between touchstart and touchend.

fastclick?

Will you update the readme to explain how this is different than fastclick.js? Thanks :)

Behavior on touch devices that have a mouse

What happens, if you have a touch device that also has a mouse or equivalent pointing device, say a PC with Windows 8 and a touch screen. I guess then the elements would not react to click events, would they? Also, what's the case if you select an element with the keyboard and hit enter?

Unfortunately I cannot verify my worries on real hardware, since I don't have a touch PC.

Breaks scolling

At the end of user scrolling a click event gets fired due to the way touche works (touchend)

TypeScript declaration file?

Hi! Does this library have a TypeScript .d.ts file associated with it so I can use it in a TypeScript project?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.