im trying to loop an array with a setTimeout continuously ive tried creating a function with a for loop inside the function then calling the function at the end but have not luck
Id like to ad fadeIn and fadeOut but have had no sucess either.
heres my code
var anmt1 = "name1";
var anmt2 = "name2";
var anmtArray = new Array(anmt1,anmt2,anmt3,anmt4);
if(!anmtArray.length){
$('#ancmtSpan').text("More Announcements coming soor");
}
else{
for (var i = 0; i < anmtArray.length; i++) {
function looping(i, t) {
setTimeout(function() {
$('#ancmtSpan').html(anmtArray[i]);
}, t* i);
};
looping(i, 5000);
} }