jQuery中animate()方法

怎样用jQuery中的animate()方法让一个图片产生上下晃动的效果呢?或者其它的什么好的方法也可以。最好有演示代码,求帮忙,谢谢

方法有很多,用定时器,每1秒执行一个事件,上,下

setInterval(functoin(){

$("#div").animate({top:10px});

setInterval(function(){
$("#div").animate({bottom:10px});
},1000);

},1000);

http://www.w3school.com.cn/jquery/effect_animate.asp
这个可能对你有帮助,试试吧。

 <!DOCTYPE html> 
<html>
<head> 
    <script src="http://lib.sinaapp.com/js/jquery/1.8.3/jquery.min.js"></script>
    <style>
    </style>
</head> 
<script>
    function shake(o){
    var $panel = $("#"+o);
    box_top = ($(window).height() -  $panel.height()) / 2;
    $panel.css({'top': box_top,'position':'absolute'});
    for(var i=1; 4>=i; i++){
        $panel.animate({top:box_top-(40-10*i)},50);
        $panel.animate({top:box_top+2*(40-10*i)},50);
    }
  }
</script>
<body> 
    <div id='sidepic'>111111</div>
</body> 
<script>
    shake('sidepic');
    </script>
</html> 

javascript图片抖动效果jQuery插件

用定时器,每1秒执行一个事件