Click through div to underlying elements

后端 未结 16 2117
逝去的感伤
逝去的感伤 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:30

    Yes, you CAN do this.

    Using pointer-events: none along with CSS conditional statements for IE11 (does not work in IE10 or below), you can get a cross browser compatible solution for this problem.

    Using AlphaImageLoader, you can even put transparent .PNG/.GIFs in the overlay div and have clicks flow through to elements underneath.

    CSS:

    pointer-events: none;
    background: url('your_transparent.png');
    

    IE11 conditional:

    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='your_transparent.png', sizingMethod='scale');
    background: none !important;
    

    Here is a basic example page with all the code.

提交回复
热议问题