IntervalForSlider

by aprudencio

HTML

<div id="hola"></div>

JavaScript

var t = null;
var t2 = null;
var c = 1;
emp();
function emp()
{
    t = setInterval(function () {
        $("#hola").html($("#hola").html()+" "+c);
        clearInterval(t);
        f10();
    },1000);
}

function f10()
{
    clearInterval(t);
    clearInterval(t2);
    t2 = setInterval(function () {
        if(c==5)
        { 
            clearInterval(t2);
            c=1;
            emp();
        }
        else
        {
         c++;   $("#hola").html($("#hola").html()+c);
            
        }
        
    },2000);
}