【发布时间】:2020-05-11 09:13:01
【问题描述】:
我已经通过https://www.image-map.net/创建了图片映射代码。但我想将座位号显示为所选坐标上的文本,以便用户可以理解并单击给定的坐标。希望我能够解决这个问题。请提供解决方案,在此先感谢。
<img src="https://www.roomsketcher.com/wp-content/uploads/2017/11/RoomSketcher-Office-Floor-Plan-with-Garden-3D-PID3861359.jpg" usemap="#image-map">
<map name="image-map">
<area target="_self" alt="seat 1" title="seat 1" href="" coords="49,52,10" shape="circle">
<area target="_self" alt="seat 2" title="seat 2" href="" coords="95,52,9" shape="circle">
<area target="_self" alt="seat 3" title="seat 3" href="" coords="69,90,12" shape="circle">
<area target="_self" alt="seat 4" title="seat 4" href="" coords="161,52,10" shape="circle">
<area target="_self" alt="seat 5" title="seat 5" href="" coords="203,51,9" shape="circle">
<area target="_self" alt="seat 6" title="seat 6" href="" coords="179,78,13" shape="circle">
<area target="_self" alt="seat 7" title="seat 7" href="" coords="251,35,13" shape="circle">
<area target="_self" alt="seat 8" title="seat 8" href="" coords="301,70,9" shape="circle">
<area target="_self" alt="seat 9" title="seat 9" href="" coords="282,93,10" shape="circle">
</map>
.seat1 {
position: relative;
}
.seat1:before {
position: absolute;
content: 'seat 1';
background: red;
color: #fff;
width: 45px;
padding: 2px 5px;
font-size: 12px;
}
img {
position: relative;
filter: grayscale(100%);
}
【问题讨论】:
-
请提供您的尝试。
-
也欢迎任何其他方式或想法
-
我尝试在给定的 codepen url 上添加红色背景的座位 1
-
将相关代码添加到问题本身。
-
你已经用 JavaScript 标记了这个问题,我假设你也尝试过用 JS 完成的解决方案 ..?
标签: javascript imagemap