【发布时间】:2015-01-12 05:18:24
【问题描述】:
我为我的网站徽标制作了动画,代码在 jsfiddle 中运行良好,但是当我将其上传到 wordpress 时,我的一个功能(动画)似乎无法正常工作(图片没有向左和向上移动),而其他(旋转)工作正常。这是我的代码:http://jsfiddle.net/5nwdjbp6/
(function rotation() {
$({deg: 325}).animate({deg: 345}, {
duration: 1200,
step: function(now){
$('.random').css({
transform: "rotate(" + now + "deg)"
});
}
}).animate({deg: 325}, $.extend(true, {}, {
duration: 2000,
step: function(now){
$('.random').css({
transform: "rotate(" + now + "deg)"
});
}}, {
complete: function() {
rotation();
}
})
);
})();
(function animation() {
$('.random').animate({
left: "130px",
top: "105px",
},
{
duration: 1200,
}
)
.animate({
left: "90px",
top: "90px",
},
$.extend(true, {}, {
duration: 2000,
}, {
complete: function() {
animation();
}
})
);
})();
有什么想法吗?
【问题讨论】:
-
你确定CSS样式是一样的吗?尤其是位置。
-
位置在 wp 中是相对的,并且该 div 也放置在引导列中。尝试将位置更改为绝对位置 - 无效
标签: jquery wordpress jquery-animate jsfiddle