Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
188
rated 0 times [  190] [ 2]  / answers: 1 / hits: 21980  / 12 Years ago, wed, may 2, 2012, 12:00:00

I'm developing a jquery component which works primarily for ipad. So is there anyway to simulate 'touchstart and 'touchend' events in desktop rather than having the device itself to check the events.


More From » jquery

 Answers
8

You can author your own custom events within jQuery:



var event = $.Event( touchstart, { pageX:200, pageY:200 } );


And you can issue them against any element in the DOM:



$(body).trigger( event );


Demo: http://jsbin.com/ezoxed/edit#javascript,html

Further reading: http://api.jquery.com/category/events/event-object/



Keep in mind that there are various other types of interfaces on the market now that don't support touchstart and touchend events. For instance, Windows 8 is already occupying tablets in the mobile market, and it uses a more abstracted event model consisting of Pointers.


[#85857] Monday, April 30, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lamontm

Total Points: 482
Total Questions: 99
Total Answers: 91

Location: Burkina Faso
Member since Thu, Dec 15, 2022
2 Years ago
;