This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Dae Hyuk Yoon
Posted Jul 03 - Read on Facebook

Is there an elegant way to only allow event listeners on the top layers to be active and block any other listeners?

3 Comments

Benjamin Den Boer

Hey Dae Hyuk Yoon - This may be what you're looking for → Let's say that layerB is a layer that is positioned on top of layerA, and layerA has a Click Event listener. Now, clicking layerB will trigger a click on layerA, too. To prevent this, you could add the following:

layerB.on Events.Click, (event) ->
event.stopPropagation()

Dae Hyuk Yoon

Thanks Benjamin. I guess with this method, I still have to manually find all the layers with a click event and stop and unstop the layers.

Dae Hyuk Yoon

My bad, I've misunderstood it. It's working now and it's so much better than setting ignoreEvents on all the other layers. Thanks again Benjamin Den Boer

Read the entire post on Facebook