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

What is Framer? Join the Community
Return to index
Alex Clayton
Posted Aug 05 - Read on Facebook

I have a button that has two different events each in a separate function. On click it does cycles through icons 1,2,3 and on long press it switches to cycle through icons 4,5,6 (another long press then switches back to cycle through 1,2,3).

After running the long press and releasing the mouse, it still fires the on click event, thus pushing the lit icon up to the next one. How can I get it to ignore the on click after a long press?

4 Comments

Trần Thanh Vũ

This is my simple way to distinguish between click and longpress event. I use an allowClick variable check. Initially, it (allowClick) is set to "1". When a longpress event is occured it's set to 0, when a mouseDown it's set to "1" again.

Trần Thanh Vũ

If Click event is occured when allowClick = 1 let do what we want, otherwise do nothing

Trần Thanh Vũ
Alex Clayton

🙏 thank you this worked!

Read the entire post on Facebook