Animated/timed text with JavaScript return -
i have following code:
function list() { return "blob1<br>blob2<br>blob3"; }
when code run, directly displays whole text in return
on call of function.
is there way make display blob1
, wait 0.5 seconds, display blob2
, after 0.5 more seconds display blob3
?
this how might it:
var stack = ["blob1", "blob2", "blob3"]; function nextitem() { document.body.innerhtml += stack.shift() + "<br>"; } nextitem(); settimeout(nextitem, 500); settimeout(nextitem, 1000);
Comments
Post a Comment