$("#btn").click(function () {
$(this).text('in progress');
console.log("--Start process--");
var hold = 500;
var elems = $(".col-xs-3");
var count = elems.length;
elems.each(function (i, t) {
var $this = $(t);
setTimeout(function () {
console.log("Start animation " + $this.text());
if ($this.hasClass("flip_effect_vertical")) {
$this.removeClass("flip_effect_vertical");
} else {
$this.addClass("flip_effect_vertical");
}
$this.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
console.log("End animation " + $this.text());
});
}, i * hold);
success();
});
function success() {
alert("Success");
console.log("--End process--");
$("#btn").text('start');
}
});
$("#btn").click(function () {
$(this).text('in progress');
console.log("--Start process--");
var hold = 500;
var elems = $(".col-xs-3");
var count = elems.length;
elems.each(function (i, t) {
var $this = $(t);
setTimeout(function () {
console.log("Start animation " + $this.text());
if ($this.hasClass("flip_effect_vertical")) {
$this.removeClass("flip_effect_vertical");
} else {
$this.addClass("flip_effect_vertical");
}
$this.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
console.log("End animation " + $this.text());
});
}, i * hold);
if (i === --count) success();
});
function success() {
alert("Success");
console.log("--End process--");
$("#btn").text('start');
}
});