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

What is Framer? Join the Community
Return to index
Lukas Imrich
Posted Jul 14 - Read on Facebook

Hi All,

I am learning to work with Framer.js, and definitely not experienced in Javascript, thats why I hope someone will help me here.

My problem:
I have overlapping layers, and I am listening to the touch events which are fired on the back layer.

However I want to take action only, if visible part of the back layer is touched. How can achieve that?

Thanks!

4 Comments

Koen Bok

They call the way events hit targets in a specific order in js "event bubbling". If you read this you should be able to figure it our easily: http://javascript.info/tutorial/bubbling-and-capturing

Lukas Imrich

Thank you for you answer. The links were indeed useful.
I came up there with two solutions of my problem:
The easy way, I just activated event listening on the upper layer.
The weird way :), I checked the touchEvent object and find out that I can track X,Y coordinates of touch events.

Marek Minor

Hi Lukas Imrich, I had the same problem, and I've found a solution in one example project:

layer.on Events.Tap, (event) -> event.stopPropagation()

Read the entire post on Facebook