$(function () { var queueList = [ function () { $("div").animate({ height: 80, top: 40 }, "fast", nextqueue); }, function () { $("div").animate({ height: 20, top: 100 }, "fast", nextqueue); }, function () { $("div").animate({ height: 40, top: 80 }, "fast", nextqueue); }, function () { $("div").animate({ height: 60, top: 60 }, "fast", nextqueue); }, function () { $("div").animate({ height: 80, top: 40 }, "fast", nextqueue); }, function () { $("div").animate({ height: 20, top: 100 }, "fast", nextqueue); }, function () { $("div").animate({ height: 40, top: 80 }, "fast", nextqueue); }, function () { $("div").animate({ height: 60, top: 60 }, "fast", nextqueue); }, function () { $("div").animate({ height: 80, top: 40 }, "fast", nextqueue); }, function () { $("div").animate({ height: 20, top: 100 }, "fast", nextqueue); }, function () { $("div").animate({ height: 40, top: 80 }, "fast", nextqueue); }, function () { $("div").animate({ height: 60, top: 60 }, "fast", nextqueue); }, function () { $("div").animate({ height: 60, top: 60 }, "fast"); } ]; function nextqueue() { $("div").dequeue("fxDome"); }; $("#start").click(function () { $("div").queue("fxDome", queueList); nextqueue(); }); $("#stop").click(function () { $("div").queue("fxDome", []); $("div").stop(); }); });