我有这个代码在Firefox和IE中运行良好,但在Chrome中没有。它的作用是,当光标在其上时,它会在现有图像上启动幻灯片图像动画。是否有Chrome不支持的代码部分?
<td width="214">
<div style="margin-left:19px; margin-top:-8px">
<div class="wrapper">
<img src="icon1.png">
<a href="http://www.somesite.com" target="_blank">
<img id="slide" src="slide_img.png" />
</a>
</div>
</div>
</td>
.wrapper{
position: relative;
overflow: hidden;
width: 197px;
height: 162px;
}
#slide{
position: absolute;
left: -197px;
width: 197px;
height: 162px;
background: transparent;
transition: 0.5s;
}
.wrapper:hover #slide {
transition: 0.3s;
left: 0;
}
答案 0 :(得分:3)
问题出在包装器的第一张图片中。尝试为div提供背景而不是使用img标记
修改后的HTML
<td width="214">
<div style="margin-left:19px; margin-top:-8px">
<div class="wrapper" >
<a href="http://www.biography.com/imported/images/Biography/Images/Profiles/K/Kaka-559558-1-402.jpg" target="_blank">
<img id="slide" src="http://3.bp.blogspot.com/-9qLJXsHoVag/T_rA4WlE-PI/AAAAAAAAB0I/I4gHxidRYEY/s320/kaka.jpg" />
</a>
</div>
</div>
</td>
和css
.wrapper{
position: relative;
overflow: hidden;
width: 197px;
height: 162px;
background:url('http://www.biography.com/imported/images/Biography/Images/Profiles/K/Kaka-559558-1-402.jpg')
}
答案 1 :(得分:0)
您需要为此
提供前缀.cssname
{
transition: 0.5s;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
}