0

I am trying to make my website work on touch devices. On desktop devices I capture every click and if the target is child of a link i do some stuff and prevent the default. But on touch devices, android emulator right now, there the target is just the div container of the overall page, so I cannot find any link parent.

How can I get the link?

Greetings philipp

philipp
  • 15,947
  • 15
  • 61
  • 106
  • You could try using my unified touch events: https://github.com/benmajor/jQuery-Mobile-Events – BenM Oct 22 '12 at 09:07
  • @BenM ― I could but right now I would prefer not to include a whole library just to handle a single »touch«, perhaps you could just tell me how you approached to find the target in your lib? – philipp Oct 22 '12 at 11:26

1 Answers1

0

What you are trying to do, is to capture all events from all elements and then to check which target it is.

Do it from the other side.

You should define the eventListener only for the element/elements you need, and use inside your handler eventPropagation, it will stop propagation to parent elements:

e.stopPropagation()
webdeb
  • 12,993
  • 5
  • 28
  • 44