Languages

Menu
Sites
Language
How to use touch event

Hi,

Touch event is not working.I want to develop application which required touch event.How can i do this in TIZEN

 

 

thanks and regards

Mohit Kumar

 

 

Responses

3 Replies
Palitsyna

Hello,

you can use following code:

document.addEventListener('touchstart', function() {
    console.log("Touch Started");
});

document.addEventListener('touchmove', function() {
	console.log("Touch Move");
});

document.addEventListener('touchend', function() {
	console.log("Touch Ended");
});

You can find more information here:

https://developer.mozilla.org/en-US/docs/Web/API/Touch_events

http://www.w3.org/TR/2013/WD-touch-events-20130124/#list-of-touchevent-types

 

Regards,

Svetlana Palitsyna

Alex Dem

Hi,
fyi: here are tutorials also:
https://developer.tizen.org/development/tutorials/web-application/w3chtml5supplementary-features/device/touch-events-version-1-0
https://developer.tizen.org/development/articles/multi-touch-web-applications
also you could look at Web App Sample->'Touch Paint' example or look at some other which have used touch events.
Alexey.

Jean Yang

Hi,

You can also look at another Web App Sample->"Piano" example. It included how to handle the touch event.


// Bind piano key press.
keys.addEventListener(
    'touchstart',
    this.onPianoKeyTouchDown.bind(this)
);
keys.addEventListener(
    'touchmove',
    this.onPianoKeyTouchDown.bind(this)
);

// Bind piano key release.
keys.addEventListener(
    'touchend',
    this.onPianoKeyTouchUp.bind(this)
);