I\'m trying to come up with something to simulate an old school modem connection. I.E. text that paints itself at variable speeds rather than rendering at once.
Her
Alternative way
var txt="Lorem ipsum dolor sit amet";
index=0;
function displayText(text) {
$('#test').append(text[index]); index ++;
$('#test').append(text[index]); index ++;
if (index < text.length) {
setTimeout(function(){ displayText(txt) }, 1);
}
}
displayText(txt);
DEMO.
Or using a closer
function txt_show(text)
{
var index=0;
var txt=text;
displayText();
function displayText() {
$('#test').append(txt[index]); index ++;
$('#test').append(txt[index]); index ++;
if (index < txt.length) setTimeout(displayText, 1);
}
}
var txt="Lorem ipsum dolor sit amet";
txt_show(txt);
DEMO.
But in IE
it'll be slower (Only tested in IE8, FF and Chrome).