How to make it so that Hovering Over Transparency in a PNG doesn't count as hovering?

前端 未结 2 2242
你的背包
你的背包 2021-02-09 20:09

When I hover over the transparent part of a PNG, it still acts as though I\'m hovering over the actual image. Is there a way that I can prevent that from happening? So that it o

2条回答
  •  春和景丽
    2021-02-09 20:19

    I know I've seen sites that let you "choose a color" based on the pixel you're hovering over. I'm not sure how they do it, but one option is to create an html image map (like this), so that different parts of your PNG trigger the "hover" and other parts don't. In essence, the mouse isn't hovering over the PNG; it's hovering over areas that you define in your HTML.

    Here's an example that I took directly from the link above:

    
    
    
    
    
    
    
    
    

提交回复
热议问题