[英]link html css and an image
在html dom上应该有一个JavaScript的onhover方法。
<div id="point1" onmouseover="doHover('point1', true);" onmouseout="doHover('point1', false);"></div>
那么,您对div有问题吗?
function doHover(id, bool) { var obj = document.getElementById("hoverPoint"+id); if(bool) { obj.style.backgroundColor="green"; }else { obj.style.backgroundColor="blue"; } }
.hoverPoint { position:absolute; top: 0px; left: 0px; width:100px; height:100px; display:block; background-color: blue; opacity: .6; } #hoverPoint1 { top: 130px; left: 135px; }
<img src="http://i.stack.imgur.com/sUTxI.png" style="width:777px; height:292px" /> <div class="hoverPoint" id="hoverPoint1" onmouseover="doHover(1,true);" onmouseout="doHover(1,false);"></div>
我通过在Photoshop中删除红点解决了问题,然后使用纯html将其添加(我用红点的背景图像制作了按钮),然后将这些点随机放置在路线图上
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.