翻转图像,不同的图像出现在下面
我试图做一个图像的网格,一旦你悬停在一个,它的网页标题出现在它下面,以及其周围的其他图像改变不透明度。翻转图像,不同的图像出现在下面
我设法创建了我想要的不透明鼠标悬停效果,但是现在我无法在将鼠标悬停在相应图像上时使页面标题图像显示出现问题。我希望这是有道理的
希望有人可以提供帮助。这里是我的代码
HTML:
<div style="position: relative; left: 140px; top: 0px;">
<img src="window.jpg" style="position: relative; top: 0; left: 0;"/>
<div id="windowimages">
<a class="image-one"></a><a href="https://example-site.com/music/">
<img src="pic1.jpg/>
<a class="image-two"></a><a href="https://example-site.com/dance/">
<img
src="pic2.jgp"/>
<a class="image-three"></a><a href="https://example-site.com/art/">
<img
src="pic3.jpg" />
<a class="image-four"></a><a href="https://example-site.com/aboutus/">
<img
src="pic4.jpg"/>
</div>
CSS:
body {
}
#windowimages {
position: absolute;
left: 3px;
top: 4px;
font-size: 0;
width: 198px;
margin: 0 auto;
padding:1px;
overflow:hidden
}
#windowimages img {
width:90px;
height:90px;
margin: 3px;
cursor:pointer;
-webkit-transition:opacity 0.26s ease-out;
-moz-transition:opacity 0.26s ease-out;
-ms-transition:opacity 0.26s ease-out;
-o-transition:opacity 0.26s ease-out;
transition:opacity 2s ease-in-out;
}
#windowimages:hover img {
opacity:0.55;
}
#windowimages:hover img:hover {
opacity:1;
}
如果我理解正确的你,好像你想要做的就是添加一个标题到每个图像上悬停。
看看这个例子中,我写道:http://jsfiddle.net/arthurcamara/chbsL3pq/
的关键部分,添加标题为.image:hover:after
,你可以在上面看到,并在下面的代码:
.grid:hover .image:hover:after {
display: block;
position: absolute;
top: 5px;
width: 90px;
padding: 5px;
content: attr(data-title);
text-align: center;
background-color: #333;
color: #fff;
}
我改变你的标记位作为以使其更加语义化。看看这个例子,让我知道如果这有助于:)
非常感谢Arthur!这或多或少是我想要的:)现在就调整标题文本的位置 – 2014-10-23 14:33:19
尽管这样起作用,但我意识到如果页面标题会显示在下方的网格图像上,并且位于相同的位置,我更喜欢。我创建了我想要显示的文本图像,所以基本上我想知道的是如何将鼠标悬停在其中一个网格图像上(如Arthur的示例所示),并触发相应的页面标题jpg出现? – 2014-10-24 13:16:36
澄清你想要什么? – Rasel 2014-10-18 11:10:49