【发布时间】:2012-12-26 05:26:03
【问题描述】:
您好,我正在尝试将以下 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});
});
});
【问题讨论】:
-
你试过的 jQuery 代码在哪里?
-
用已经尝试过的代码编辑了帖子。它破坏了页面上的所有其他脚本并且没有工作。
-
{margin-top:'220px'}语法无效,您的代码无法编译,可能是{"margin-top":'220px'},或{marginTop: '220px'}
标签: jquery html css jquery-animate css-transitions