javascript - Looping within functions -
i'd repeat piece of code 2 second interval inbetween, how so?
$(document).keydown(function(e) { kkeys.push( e.keycode ); if ( kkeys.tostring().indexof( konami ) >= 0 ) { $(document).unbind('keydown',arguments.callee); $('.preview').attr('style', 'background: #'+math.floor(math.random()*16777215).tostring(16) + ';'); } });
with being repeated:
$('.preview').attr('style', 'background: #'+math.floor(math.random()*16777215).tostring(16) + ';');
you want use conjunction of
settimeout()
with recursive call function , proper base case.
you can keep argument total time elapsed , use want. can use
setinterval()
that should put on right track
Comments
Post a Comment