Monday, May 20, 2024
-4
rated 0 times [  0] [ 4]  / answers: 1 / hits: 33292  / 15 Years ago, mon, june 22, 2009, 12:00:00

I have 2 z-index layers in a map application I'm building. I have a problem when I click on the layers to zoom in. The click handler is on the underlying z-index layer and I don't want it to fire when a control in the overlying layer is clicked.



The problem i have is that the event gets raised no matter what but the originalTarget property of the event is not the image in the underlying layer when something on the top layer is clicked. Is there anyway to change this?


More From » event-handling

 Answers
32

It's called event-bubbling, and you can control it with the event.stopPropagation() method (event.cancelBubble() in IE). You can also control it by returning true/false from handlers called by onwhatever attributes on elements. It's a tricky subject so I suggest you do some research.



Info: cancelBubble, stopPropagation


[#99269] Wednesday, June 17, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyquandaquanl

Total Points: 122
Total Questions: 109
Total Answers: 101

Location: South Georgia
Member since Sun, Aug 8, 2021
3 Years ago
;