Search code examples
javascripttouchdom-events

Can I make make touch events pass through a layer?


I'm making a JavaScript game where the goal is to tap animals. When you do it right I show a bonus layer with stars on top of the animal, but the stars also capture touch events when they are visible. Is there any way to make touch events pass right through the stars to the animal below?


Solution

  • Yes, set up pointer-events: none; on the stars, and they will act as they're invisible to pointer (and touch) events.