我正在创建一个销售页面,其中会有几个产品photoshopped放到背景图像上。我希望客户能够将鼠标悬停在产品上的某个点上,以显示其信息并包含类似于http://www.wineenthusiast.com/custom-cellars/的链接,但我希望在纯CSS中执行此操作。我只希望信息和链接出现在用户悬停在点上,然后在包含div上。我一直遇到的问题是,因为两个元素都包含在同一个div中,所以会显示相应的图像。当此页面上有15种产品时,这会太麻烦。仍然是noob编码器,所以任何帮助将不胜感激,谢谢!CSS悬停在点上以显示图像 - 不在图像上悬停
这里的小提琴:http://jsfiddle.net/jakvisualdesign/hvb77m8L/2/
和代码:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<link rel="stylesheet" href="style.css">
<title>JS Bin</title>
</head>
<body>
<div id="container">
<div class="base">
<img src="https://s3.amazonaws.com/steinersports/CMS+Pages/Yankees+Man+Cave/background.jpg" />
</div>
<div class="pop-container-a">
<img src="https://s3.amazonaws.com/steinersports/CMS+Pages/Yankees+Man+Cave/background.jpg">
<div class="dot"></div>
</div>
</div>
</body>
</html>
和CSS: #container的{ 位置:相对; width:960px; margin-left:auto; margin-right:auto; }
.base {
width: 100%;
height: 100%;
position: absolute;
}
#container.pop-container-a img {
position: absolute;
}
.dot {
width: 10px;
height: 10px;
position: absolute;
background-color: red;
z-index: 10;
border-radius: 50%;
}
.pop-container-a img {
position:absolute;
opacity: 0;
width: 150px;
transition: opacity .5s ease;
}
.pop-container-a:hover .dot, .pop-container-a:hover img {
opacity: 1;
}
.pop-container-a {
position: absolute;
top: 100px;
left: 50px;
display: inline-block;
}
请编写您的JavaScript代码。 – Kumar 2015-04-03 09:32:01