キューの取得、実行
$(function(){ $("#sample1Btn").click(function () { $("#sample1Div").show("slow"); $("#sample1Div").animate({ marginLeft: '+=200' }, 3000); $("#sample1Div").queue(function(){ $(this).addClass("newColor"); $(this).dequeue(); }); $("#sample1Div").animate({ marginLeft: '-=200' }, 1500); $("#sample1Div").queue(function () { $(this).removeClass("newColor"); $(this).dequeue(); }); $("#sample1Div").fadeOut(); }); });
$(function(){ $("#s2Div").hover(function(){ $("#s2Div span:eq(0)").animate({ "margin-left": "80px" }, 1000); $("#s2Div span").queue(function(){ $(this).css("color", "green"); }); }); });