jQuery touch events

How to manage touch events. When I write several touchstart on different elements, they all work at once and I can't separate them. Tell me how to properly manage them without third-party libraries.

$(".content").on("touchstart", function(){
    $(this).stop().animate({top: '-50px'}, 600);
});

If you write in another touchstart on a completely different element, they will work simultaneously.

I tried to find it in Google, but I didn't find it. Maybe I was looking in the wrong place.

I would be grateful for a hint or a small tutorial maybe where there is

Author: Dmitriy Simushev, 2015-08-28

1 answers

Does not play. Look for where you have incorrectly set selectors or the event pops up in another element.

Sandbox

$(".content").on("touchstart", function(){
    alert('content');
});

$(".content2").on("touchstart", function(){
    alert('content2');
});

It works out correctly, when you click on a specific element, it outputs only one alert.

 1
Author: LbISS, 2015-09-05 07:29:16