Chaining Animation
Three divs chained together to quickly disappear, based off of an array of selectors.
by tylerbrownhenry
HTML
<div class="cell action" id="1" action="switch" brother="3"></div>
<div class="cell" id="2" ></div>
<div class="cell action" id="3" action="switch"></div>
CSS
.cell{
width:35px;
height:35px;
background-color:#333;
}
JavaScript
append = [];
append.push({id:1});
append.push({id:2});
append.push({id:3});
console.log(append.length);
(function hidenext(item){
currentItem = $("#"+item[0].id);
if(currentItem.hasClass('action')){
var action = currentItem.attr('action');
var brother = currentItem.attr('brother');
console.log(action,brother);
};
currentItem.fadeOut("fast", function(){
(item=item.slice(1)).length && hidenext(item);
});
})(append)