JS:
$(function(){
chainAnim('.section','slow','1') });
function chainAnim(e,s,o) {
var $fade = $(e);
var code = "console.log('Done.');";
$fade.each(function(){
code = "$('#"+$(this).attr('id')+"').fadeTo('"+s+"','"+o+"',function(){"+code+"});";
});
eval(code);
}
HTML:
<div id="wrapper">
<div class="section" id="section-1">Section 1</div>
<div class="section" id="section-2">Section 2</div>
<div class="section" id="section-3">Section 3</div>
<div class="section" id="section-4">Section 4</div>
</div>
When animating,section 4 is animated in first. How can I reverse this?