简体   繁体   English

图像可点击多区域方法

[英]Image clickable multiple areas approach

I've just started to learn web development and I have an idea to do the following: Take simple image (jpeg/png) and make some areas of that image clickable (or other events on those areas).我刚刚开始学习 Web 开发,我有一个想法可以执行以下操作:获取简单图像 (jpeg/png) 并使该图像的某些区域可点击(或这些区域上的其他事件)。 For example, when I click on specific area on the image, this area highlights, other part of the image shadows.例如,当我单击图像上的特定区域时,该区域会高亮显示,而图像的其他部分会变暗。 First what I googled was HTML map/area tags.首先我用谷歌搜索的是 HTML 地图/区域标签。 But I want to know other approaches which I can use to do that.但我想知道我可以用来做到这一点的其他方法。 Just give me some keywords, nothing more.给我一些关键字,仅此而已。

Thanks in advance提前致谢

I stumbled upon the same problem some time ago:前段时间我偶然发现了同样的问题:

  • HTML maps tags are the quickest way but in the long run often give problems often because of the lack of support. HTML 地图标签是最快的方式,但从长远来看,由于缺乏支持,经常会出现问题。
  • Going for an SVG image which is widely supported across all browsers is a good solution.寻找所有浏览器都广泛支持的 SVG 图像是一个很好的解决方案。 There are many JPEG/PNG to SVG converters on the web (even if quality would not be the same)网络上有许多 JPEG/PNG 到 SVG 转换器(即使质量不一样)
  • Another brutal approach is to create some clickable overlay divs over the image, it is a good approach if the areas to click are rectangular.另一种粗暴的方法是在图像上创建一些可点击的覆盖 div,如果要点击的区域是矩形的,这是一个很好的方法。

Hope you find a good solution :)希望你找到一个好的解决方案:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM