Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have written a script that changes the box's color in another box's hover: http://jsfiddle.net/w5b9v/2/

How can I add animation to this transition? Thanks in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
178 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could do something this way http://jsfiddle.net/steweb/fn68L/

js:

$(document).ready(function(){
$(".wrapper div.me:last").addClass("reduce");
  $(".wrapper div.me").hover(
  function(){
     $(this).fadeTo('fast',1); //or $(this).animate({opacity:1},300/*ms*/)
     $(".wrapper div").not(this).fadeTo('fast',0.8);
  }); 
});

Or you can check Animate to Class jquery plugin ;)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...