Brad Mの回答を拡張して、この種のアプローチを取ることができます。
http://jsfiddle.net/mori57/Gqttc/
この HTML を考えると:
<div id="clickme">Click here</div>
<div id="lines">
<div id="line1">
<img src="http://placehold.it/350x40" alt="" />
</div>
<div id="line2">
<img src="http://placehold.it/350x40" alt="" />
</div>
<div id="line3">
<img src="http://placehold.it/350x40" alt="" />
</div>
</div>
そしてこのCSS:
#lines div {
opacity:0;
margin-left:-400px
}
jQuery でこのアプローチを取ることができます。
// get your lines into an array
var lines = $("#lines div");
// set a counter
var currAnim = 0;
// this method will animate a line
var fadeMoveIn = function (line) {
$(line).animate({
opacity: 1,
marginLeft: 10
}, {
queue: true,
duration: 1000,
complete: function () {
// when this line's animation is done
// trigger the next in the queue
startQueue();
}
});
};
// this function will fire off your animations one by one
var startQueue = function () {
// increment the queue and send that line to be animated
fadeMoveIn(lines[currAnim++]);
};
$("#clickme").click(function () {
startQueue();
});
これを管理する方法についてのアイデアが得られることを願っています! ブラッドの方法は良い出発点ですが、すべての div を同時にアニメーション化します。これは、あなたが探していたと思う効果ではありません。