开发者

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

开发者 https://www.devze.com 2023-03-05 19:49 出处:网络
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.

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

精彩评论

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