【发布时间】:2021-05-26 20:56:57
【问题描述】:
我试图在悬停时更改地板的颜色。 https://imgur.com/a/pXEmNXp 这是我正在尝试做的图像。
我在这篇文章中尝试了答案:How can we draw 3D bulding structure from existing image Jquery,Css?,但是当我实际悬停在地板上时它不起作用,它只在我悬停在图像底部的随机位置时显示。
我该怎么做才能在我悬停时显示特定楼层,以及如何实际实现每个楼层的地图属性?
如果有帮助,这是我的代码:
$(document).ready(function () {
$('map').on('mouseenter', function () {
$('.highlight-4').show();
})
$('map').on('mouseleave', function () {
$('.highlight-4').hide();
})
});
.highlight {
z-index: 9999;
display: none;
pointer-events: none;
}
.building {
position: absolute;
margin-left: 11%;
box-shadow: 0 15px 30px rgba(0, 0, 0, .6);;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
HTML
<img class="highlight highlight-4" src="/static/floor-4.png" alt="">
<img class="highlight highlight-3" src="/static/floor-3.png" alt="">
<img class="highlight highlight-2" src="/static/floor-2.png" alt="">
<img class="highlight highlight-1" src="/static/floor-1.png" alt="">
<img class="highlight highlight-0" src="/static/floor-0.png" alt="">
<img usemap="#image-map" class="building" src="/static/apartments.jpeg" alt="">
<map name="image-map">
<area target="" alt="" title="" href="" coords="1121,326,197,662,191,747,1130,473,1398,664,1387,544"
shape="poly">
</map>
【问题讨论】: