Hello i need to display by slide multiple entry by ajax my script work just for one entry
var newTxt = ['hello', 'hi'];
for(var i = 0; i <= newTxt.length; i++) {
$('#txt').prepend('<li class="none">' + newTxt[i] + '</li>');
$('#txt li:first-child').toggleClass("none", 2000);
}
i use css and toggleClass for animation
li { width:100px; }
li.none { width:0px; }
The animation work with 1 entry but with more not work u have solution for display by slide one by one ?
Thanks you
Edit (now its work but all setTimeout exucute in same time)
var newTxt = ['hello', 'hi'];
for(var i = 0; i <= newTxt.length; i++) {
setTimeout(function(y) {
$('#txt').prepend('<li style="width:0">' + newTxt[i] + '</li>');
$('#txt li:first-child').animate({'width':'100px'}, 1000);
} (i), (i * 2000));
}
Demo https://jsfiddle.net/HHsxc/292/ i need to slide first wait slide seconde wait ...