Hi guys,

The code works perfect on fiddle (check link below) but doesnt work properly when i upload the same code online. What have I done wrong?


Member Avatar


Both look OK to me. The 'online' seems a bit quicker. Try clearing the cache?


Hold on, no the 'online' halts after a little while and then starts again.

Ah, you seem to be running flicker() twice. Once in the head and once inline in the body-onload.

Yes, calling the function in both the head and body is causing that problem.

Here is your sample code consolidated in a working html file.

<!DOCTYPE html>
 <title>Flickering Logo</title>
 <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 
  div { width:50px; height:50px; border:1px solid gray; }
  div#box2 { background-color:red; }
  div { background-color:black; }
  div.on { background-color:white !important; }

 <div id="box"></div>
 <div id="box2" style="display:none"></div>
  var interval = 300; 
    function flicker()
        setTimeout(flicker, interval)

Thanks a lot! This helped