我使用 jquery 添加了一些动画,但它不起作用:

$('.test-container').click(function(){
  $(this).css('background-color', 'rgb(119, 119, 119)');
$(this).animate({right: '50%', opacity: 0.3}, 1000);

})

这是我创建的 jfiddle:http://jsfiddle.net/eJhdm/2/

我在这里做错了什么吗?我看不到。

最佳答案

您需要为 div 设置一个位置。

<div class="test-container" style="/*other CSS*/ position:absolute;">testtt</div>

http://jsfiddle.net/3HhWx/

关于jquery - 为什么这个 div 没有动画?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9861664/

10-12 12:55
查看更多