我不明白为什么旋转会影响固定位移的图像。在IE,FF和Opera上,一切正常。演示:http://jsfiddle.net/4sUCp/10/。请帮忙。
HTML:
<div class="hover">HOVER ME</div>
<div>
<div class="img" style="left:0;">
<div class="hover">HOVER ME</div>
</div>
<div class="img img2" style="right:0;">
<div class="hover">HOVER ME</div>
</div>
</div>
CSS:
.img {
position: absolute;
margin-top: 20px;
height: 200px;
width: 50%;
background: url("http://goo.gl/jY7Kwv");
background-size: cover;
background-attachment: fixed;
}
.img2 {
background: url('http://hq-wallpapers.ru/wallpapers/2/hq-wallpapers_ru_girls_9386_1920x1080.jpg');
background-size: cover;
background-attachment: fixed;
}
.img:hover {
width: 80%;
z-index: 2;
}
.hover {
position: absolute;
top: 0;
left: 0;
z-index:1;
transition: 0.5s;
}
.hover:hover {
transform: translateY(10px) rotate(90deg);
}
z-index: -1;
添加到文本中似乎可以解决问题。演示 - Ruddy