Using setInterval into another Setinterval
Hi Friends i want to run my code with only using one setInterval function.
Currently I am using two setInterval's to achieve my goal can we get same
result with using only one 'setInterval' for your reff pleaase go to this
link http://jsfiddle.net/msUyh/ and i have also mentioned my code below
script
setInterval(function () {
$('div').css('display', 'none');
}, 5000);
var num = 2;
$('div').append('1<br/>')
setInterval(function () {
if (num <= 5) {
$('div').append(num + '<br/>')
num++;
}
}, 1000)
CSS
body, html{height:100%;}
div
{
position:absolute;
width:100%;
height:100%;
background:#000;
display:block;
font:15px Arial, Helvetica, sans-serif; color:#fff;
}
HTML
<div></div>
No comments:
Post a Comment