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

What is Framer? Join the Community
Return to index
Bryan Sebesta
Posted May 31 - Read on Facebook

Friends, is there an "offclick" event of any kind? I have a menu I am sliding out from the right, and I want it to disappear when you click off of the menu on anything else in the screen. I can't find any way of doing that, however.

4 Comments

Jordan Robert Dobson

You could make a layer that is the entire size of the screen. And when it gets a click. Attempt to close the menu if it's open.

Anton Jarl

I usually do it as Jordan describes. A create a layer with screen width and screenheight and place it behind the menu. And when the menu slides out the other object either slides out or just gets "visible: true" if you want to be able to close the menu while it's still sliding out.

I often also make the layer dark with opacity to help the menu pop out a bit as well but that's a design issue!

Krijn Rijshouwer

Hey Bryan,

You could just listen for clicks on the Screen and use stopPropagation() on the menu click event to stop it from triggering any other events (like the click on the Screen).

Check out the little example I made you → http://share.framerjs.com/4vebpiipq5ls/

Bryan Sebesta

Thank you Anton Jarl and Jordan Robert Dobson for pitching in. This all helps tremendously.

Read the entire post on Facebook