您好,我正在尝试将以下 css3 动画转换为 jquery,但运气不佳:
.portfoliobox .rollover
{
height: 220px;
width: 100%;
background: url(../img/rolloverbg.png);
margin-top: 220px;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
overflow: hidden;
}
.portfoliobox:hover .rollover
{
float: left;
margin-top: 100px;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
overflow: hidden;
}
效果可以看这里:http://www.astwood.co.uk/testsite/wordpress/
谁能帮帮我?
编辑:我已经尝试过的代码
$(document).ready(function(){
$('.portfoliobox').hover(function(){
$(".rollover", this).stop().animate({margin-top:'220px'},{queue:false,duration:160});
}, function() {
$(".rollover", this).stop().animate({margin-top:'100px'},{queue:false,duration:160});
});
});
最佳答案
这是想要的效果:
$('.portfoliobox').hover(function () {
$(".rollover").stop().animate({ marginTop: '80px' }, 160);
}, function () {
$(".rollover").stop().animate({ marginTop: '300px' }, 160);
});
关于jquery - 试图将动画从 css3 转换为 jquery,到处都是墙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14281403/