Click through div to underlying elements

后端 未结 16 2059
逝去的感伤
逝去的感伤 2020-11-21 06:19

I have a div that has background:transparent, along with border. Underneath this div, I have more elements.

Curre

16条回答
  •  情深已故
    2020-11-21 06:51

    Nope, you can't click ‘through’ an element. You can get the co-ordinates of the click and try to work out what element was underneath the clicked element, but this is really tedious for browsers that don't have document.elementFromPoint. Then you still have to emulate the default action of clicking, which isn't necessarily trivial depending on what elements you have under there.

    Since you've got a fully-transparent window area, you'll probably be better off implementing it as separate border elements around the outside, leaving the centre area free of obstruction so you can really just click straight through.

提交回复
热议问题