Got this script from an earlier post (here)
I edited this a bit so now i got:
<div id="outer" style="display: none"></div>
$(document).ready(function() {
$("#outer").css("display","block");
var $divs = $("#outer > div").hide(),
current = 0;
$divs.eq(0).show();
function loadContent() {
for(var i=0; i<20; i++) {
$("#outer").append("<div id='divs"+i+"'>test"+i+"</div>");
}
}
function showNext() {
if (current < $divs.length - 1) {
$divs.eq(current).delay(2000).fadeOut('fast', function() {
current++;
$divs.eq(current).fadeIn('fast');
showNext();
});
}
}
loadContent();
showNext();
});
The jQuery that shows and hides the divs work if I just put some into the HTML. But not when I append them in my function.