jquery - 试图将动画从 css3 转换为 jquery,到处都是墙

标签 jquery html css jquery-animate css-transitions

您好,我正在尝试将以下 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});  
    });  

});

最佳答案

这是想要的效果:

http://jsfiddle.net/tHDa4/

$('.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/

相关文章:

jquery - 将父元素滚动到子元素的顶部

html - 我们可以在 bootstrap 4 中使用部分崩溃概念吗?

html - 如何使我的缩略图呈现良好?

css - 如何使 Logo 在导航菜单和其他建议中下降一点

javascript - 使用 CSS/border-radius 遮蔽图像

Javascript 表单操作在使用 onsubmission 事件确认之前执行

jquery - 为什么下面的 Toggle 函数执行四种不同的操作而不是两种?

javascript - 如何清除 setInterval 的所有实例?

javascript - 按下键时显示弹出窗口

html - 两篇文章宽度相等如何划分一个章节?