SVG: How to ignore pointer events on transparent parts of an image

前端 未结 2 1377
温柔的废话
温柔的废话 2021-01-16 03:21

I have an SVG image map embedded on an HTML page. It contains a collection of PNG s each wrapped in a link. Some of these images overlap, however w

2条回答
  •  清歌不尽
    2021-01-16 04:15

    If I correctly understood you, then the click event should pass through the upper semi-transparent image to the bottom one and trigger on it.

    For these purposes, the attribute pointer-events ="none"

    Assigning this attribute we make the picture transparent for clicks on the red and black rectangles that are located under this picture.

     
    
    
       
       
       
      
         
       
       
     
     
    
    

    Browser support: https://caniuse.com/#feat=pointer-events

    Theory: https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events

提交回复
热议问题