30.6.12

timeout and interval

I. CSS3 animation shorthand (w3/spec)

@keyframes once { /* something */ }
@keyframes repeat { /* something */ }

#thing { animation:once 3s }
.things { animation:repeat 3s 300ms infinite }

II. js

setTimeout(function once(){ /* something */ }, 3e3);
// no direct way to specify an initial delay
setInterval(function repeat(){ /* something */ }, 3e3);

III. Hypothetical jQuery plugin (jQuery/docs)

$('#thing').timeout(function once(){ /* something */ }, 3e3);
$('.things').interval(function repeat(){ /* something */ }, 3e3, 300);

2 comments:

Mike said...

Just curious, what is 3e3?

skiterskiterio said...

Just searching for the same answer, I found 3e3 its a 3 number followed by 3 "0's" digits (a.k.a.: 3000).

The same as 3*10e3. The number you put after the "e" letter, the number of zeros you add.