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

What is Framer? Join the Community
Return to index
John Framer
Posted Sep 16 - Read on Facebook

fellas, got another question here.

I have a layer that is draggable.enabled. I also have a click event listener for that layer. Problem is that every time I drag the layer to another position the click even triggers and I don't want that. Is there a quick way to prevent the event from firing whenever I move the layer?

Thanks in advance.

8 Comments

John Framer

Benjamin Den Boer Koen Bok

John Framer

I solved the issue using hammer.js and swapping the click event listener with a tap event listener.

Would love to know though if there are alternatives

Dae Hyuk Yoon

could you share the code if you don't mind?

Dae Hyuk Yoon

Thanks Koen!

Edward Sanchez

I solved it with if statements. Create a variable called DraggingIs, set it to false to start with, then set it to true when your start drag. On your click event have it only register if DraggingIs == false.
To reset it back to false, do a delayed function to set it a second after any click.
Works very well for me.

Edward Sanchez

That has a bunch of rather specific touch events.

Read the entire post on Facebook