jQuery/animate()

解説 アニメーションを実行

animate(properties, [duration], [easing], [complete]

sample1

sample1code
$("#sample1div").click(function(){
  $(this).animate({
	  marginLeft: "30px",
	  marginTop: "30px"
	},1000);
});
sample2
sample2Div
sample2code
$("#sample2box").click(function(){
  $(this).animate({
    width: "150px",
    height: "150px",
    marginLeft: "10px"
  },1000);
});
sample3
sample3Div
sample3code
$(function(){
  $("#sample3Div").click(function(){
  	$(this).animate({
  	  marginLeft: "+=5px",
  	  width: "-=3px"
  	},100);
  });
});
sample4

アニメーション

sample4code
$(function(){
  $("#left").animate({
   	left: "100px",
   	top: "25px"
  },3000);
  $("#right").animate({
   	left: "101px",
   	top: "-24px"
  },3000);
});
sample5
s5Div
sample5code
var s5Obj = new Object();
s5Obj.duration = 1000;
s5Obj.easing = "linear";
s5Obj.complete = function (){
  alert("sample5")
}
$("#s5Btn").click(function(){
  $("#s5Div").animate({
	width:100, height:100
  }, s5Obj);
});
	
sample6
s6Div
sample6code
function s6Func(){
  $("#s6Div").animate({
	marginTop: "-=50px"
	}, 1000).animate({
	marginTop: "+=50px"
	}, 1000);
  setTimeout(s6Func, 2000);
}
	
sample7
s7Div
sample7code
function s7Func(){
  $("#s7Div").animate({
	left: "350px"
	}, 2000).animate({
	left: "-30px"
	}, 2000);
  setTimeout(s7Func, 4000);
}
	
sample8
s8Div
sample8code
function s8Func(){
  $("#s8Div").animate({
	opacity: "0.1"
	}, 1000).animate({
	opacity: "1"
	}, 1000);
  setTimeout(s8Func, 2000);
}
	
sample9
s9c1
s9c2
s9c3
sample9code
function s9Func(){
  $("#s9c1").animate({
  	width: "toggle",
  	height: "toggle"
  }, "slow", "swing", s9Func02
  );
}
function s9Func02(){
  $("#s9c2").animate({
  	width: "toggle",
  	height: "toggle"
  }, "slow", "linear", s9Func03
  );
}
function s9Func03(){
  $("#s9c3").animate({
  	width: "toggle",
  	height: "toggle"
  }, "slow", "swing"
  );
}