the problem is that I have 4 functions that I would like to run sequentially every 5 seconds or so, and I'm not sure how to do this
I know the code is inefficient as it is. (right now I have it configured so that functions can also be launched using the pressed buttons)
function tScroll1(){ var $testimonialScrollPos = parseInt($tCont.css('top'), 10); if($testimonialScrollPos == -915){ $tCont.css('top','305px'); $tCont.animate({top:'0px'},700); } else{ $tCont.animate({top:'0px'},700); } }; function tScroll2(){ $tCont.animate({top:'-305px'},700); }; function tScroll3(){ $tCont.animate({top:'-610px'},700); }; function tScroll4(){ $tCont.animate({top:'-915px'},700); }; $tBtns.eq(0).click(function(){tScroll1()}); $tBtns.eq(1).click(function(){tScroll2()}); $tBtns.eq(2).click(function(){tScroll3()}); $tBtns.eq(3).click(function(){tScroll4()});
Any help is appreciated:].
source share