开发者

Sending a click event to two completely overlapping layers (with child nodes)

开发者 https://www.devze.com 2023-02-22 01:35 出处:网络
Ok, I have page (html, javascript, css) with two layers that completely cover the browser window. The one in front contains a navigation that should clickable. The one in the back contains a map with

Ok, I have page (html, javascript, css) with two layers that completely cover the browser window. The one in front contains a navigation that should clickable. The one in the back contains a map with markers that should also be clickable. The navigation (the one in the front) at times ca开发者_Go百科n occupy the complete window height and width so limiting it's size is not really an option.

Now the problem is how to get the click events to the back layer so the map markers can receive their click event. backlayer.dispatchEvent(e) takes backlayer as the event target, but any of my markers inside the backlayer could be the target, so I was wondering if there is a simpler way then check the bounding-box of every map marker element and call dispatchEvent on the map marker that matches directly?

Thanks!


You can try using jQuery or a similar library to simulate a click on the bottom layer when clicking the upper one.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号