Skip to content Skip to sidebar Skip to footer

Z-index And Javascript Events

I have a couple of divs overlaid on each other with differing z-index values. The default behaviour for browsers seems to be the event bound to the top-most z-index div gets fired.

Solution 1:

The event doesn't actually occur on the element that is obscured by another unless the other element is contained in the first, then it will bubble up. The only way that I can think of to achieve what you want is to go through all of the potential elements and see if any of them contain the point at which the click occurred and trigger a click on that element (if it's not the current one).

Solution 2:

If you are using an javaScript framework event bubbling might be included. (ExtJS I know for sure has this kind of event feature.)

Post a Comment for "Z-index And Javascript Events"