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

What is Framer? Join the Community
Return to index
Samarth Bahuguna
Posted Jul 07 - Read on Facebook

I'm trying to detect a click outside a modal window to close it. Following other posts, I created a transparent layer just below the modal window and listened for click events on it. However, the bottom layer receives events even on clicking the window. How can I make the top layer of a stack stop events from reaching layers below it?

modalWindow and outsideClicks are the two layers I'm talking about. Both are children of the clientPage layer.

2 Comments

Dave Crow

Try setting ignoreEvents = true on the bottom layer.

Blaine Billingsley

My guess is it's because (presumably) the events that are firing are all in the same parent/superlayer ("clientPage"?). You can add event.stopPropagation to your click event to keep it from bubbling or you can not nest it in the clientPage superLayer along with all your other clicky stuff. (I think)

Read the entire post on Facebook