I am using the code below to bind "click" or "touchtart" events (using jQuery) .
what? = (Navigator.userAgent.match (/ ipad / i))? 'TouchStart': 'Click'; Later:
$ foo.on (what, function () {...}); ... which works well for the iPad and "everything", but I'm worried that the code above is "iPad Tunnel Vision" ... < P> My question: Did all other devices (for example, Android tablet) have named "TouchStart" event similarly? If so, how can I improve the above code so that I can create an account for those event types?
In other words, how would I account for the maximum number of touch devices in the above code (not just the iPad)?
Edit # 1
What people think about it:
var foo = ('optarch' in the window) ? 'TouchStart': ((document.DocumentTouch & Document document documentation)? 'Tap': 'click'); Note: Most of the above logic are.
The above firefox / iPad is working ... I have nothing else to test this time.
What do I like about things mentioned above?
Is tap for all other touch devices a good default?
Edit # 2
Something, this link:
There really is no direct answer but many Facing multiple click related events for platforms and devices, gives lots of details.
Edit # 3
Anything:
Android and iPhone Touch Event
WebKit's Android and Touch events in some common in iPhone versions:
TouchStart - triggers when triggered mouse equals - mouseDown touchmov - triggers when one touch moves Mouse equivalent - MouseSmouch Touch - Triggers are triggered when the mouse is equivalent - Mouseup is a little special on an iPhone - TouchScan Despicable After reading - Seeing a secret , I think I will change the code on it:
var foo = (window) 'Achurchch') || (Touch the document document and document presentation presentation))? 'TouchStart': 'Click'; When I first asked my question - if I did not have access to anything other than an iPad / iPhone - I took touchstream an iOS-specific The event was; It will now see the touchstart and as the basis for the touch code most if not all, if not all.
August 2014 update:
If this is any help, I have posted some useful classes here:
- < [No-js] [no-js] [not-touch] Javascript utilities that insert HTML templates for use in CSS and / or JS
js or < Code> touch class.
Comments
Post a Comment