Please somebody help me with this:
touchStart = function (evt) {
evt.preventDefault();
$(this).addClass("touched");
};
touchEnd = function (evt) {
evt.preventDefault();
$(this).removeClass("touched");
};
s.ontouchstart = touchStart;
s.ontouchend = touchEnd;
s.ontouchmove = touchEnd;
I have a section element, generated dynamically by JavaScript (ul > li > section). When I'm binding a touchstart-touchmove-touchend event listener to this section element, it works on Android, but not on iPad/iPod/iPhone.
I have tried generating it with onclick="void(0)"
attribute, it made the section element "interact" like a clickable element but it still does nothing.
It works on Android every way but this vegetable seems a little consume useless to me now... =)
Thanks in advance! =)
Nevermind, got it with jQuery. This way it runs everywhere.
$(s).bind("touchstart mousedown", function (e) {
console.log(e.type); // to get the name of the event
}).bind("touchmove mousemove", function (e) {
// ...
}).bind("touchend mouseup", function (e) {
// ...
});