开发者

What is the correct way to combine multiple animations with jQuery?

This is what I have written as my animation - however it applies to all my HTML elements with this animation at the same time instead of each one as its own animation process.

开发者_如何学C

What am I missing?

// JavaScript Document
          $(document).ready(function(){ 
               $('.learnmore').mouseenter(function(){
                  $(".cover").stop().animate({top:'150px'},{ duration:160});
                });

                $('.learnmore').mouseleave(function(){
                      $(".cover").stop().delay('2500').animate({top:'300px'},{ duration:160,easing:'easeOutBounce'});
                });


        });  


see example here. http://jsfiddle.net/robx/VdUuM/3/ Explanations also commented on there with the code.


You need more specific CSS in place of $(".cover"). Something like

$(this).children('.cover')...

Or

$('.learnmore .cover')...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜