[英]Creating buttons on an image in HTML5
I am creating a website of a map of South-East Asia.我正在创建一个东南亚地图的网站。 I want the user be able to press on country on the map and a pop up box will come up showing information of the country pressed on.
我希望用户能够在地图上按下国家/地区,然后会出现一个弹出框,显示按下的国家/地区的信息。
How will I make the buttons on the map work?我将如何使地图上的按钮工作? I have tried to transparent the countries in different images and overlay them in HTML and CSS however this did not work
我试图在不同的图像中透明化国家,并用 HTML 和 CSS 覆盖它们,但是这不起作用
img map area are exactly for this. img地图区域正是为此而已。 You can mix it with css and js if you need to add/remove classes on hover, like hide/show the country hover.
如果您需要在悬停时添加/删除类,可以将它与css和js混合使用,例如隐藏/显示国家/地区悬停。
As stated above, the most common method of doing this is by using an image map. 如上所述,最常用的方法是使用图像映射。 However, if you would like an alternative that is a little more interactive you could use jQuery.
但是,如果您想要一个更具交互性的替代方案,您可以使用jQuery。 There are a number of jQuery map / floorplan plugins that can achieve this elegantly.
有许多jQuery map / floorplan插件可以实现这一优雅。
Here are a few I have found from a simple Google search: 以下是我从简单的Google搜索中找到的一些内容:
JVectorMap - visit JVectorMap - 访问
I hope this helps! 我希望这有帮助!
有一个伟大的Jquery插件我很久以前用于此目的称为“mapster”,请在此链接中查看。
I'd try to solve this with SVG
. 我试着用
SVG
解决这个问题。
It gives you not only an ability to define complex shapes (and also export code from ex. illustrator) but also to make your UI more user-friendly (color overlays, outlines etc). 它不仅能够定义复杂的形状(还可以从ex.emprator中导出代码),还能让您的UI更加用户友好(颜色叠加,轮廓等)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.