Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Problem is when you are calling SwitchImageLoop inside setTimeout function. Your SwitchImageLoop accepts first parameter as string (id) but next time you calling your function inside setTimeout you are passing a document object as first parameter.</p> <pre><code>function SwitchImageLoop(image, imageSize){ if(imageSize == '110x110'){var randomNumber = Math.floor(Math.random()*15) + 1}; if(imageSize == '247x110'){var randomNumber = Math.floor(Math.random()*13) + 1}; </code></pre> <p>in next call document.getElementById(documentObject) will give you error</p> <pre><code> image = document.getElementById(image); var randomTimer = Math.floor(Math.random() * 3000) + 1000; FadeImages(image, imageSize, randomNumber); var endlessLoop = setTimeout(function(){SwitchImageLoop(image, imageSize)}, randomTimer); } </code></pre> <p>Rewrite your function to </p> <pre><code> function SwitchImageLoop(image, imageSize){ if(imageSize == '110x110'){var randomNumber = Math.floor(Math.random()*15) + 1}; if(imageSize == '247x110'){var randomNumber = Math.floor(Math.random()*13) + 1}; var randomTimer = Math.floor(Math.random() * 3000) + 1000; FadeImages(image, imageSize, randomNumber); var endlessLoop = setTimeout(function(){SwitchImageLoop(image, imageSize)}, randomTimer); } function FadeImages(image, imageSize, randomNumber){ image=document.getElementById(image); $(image).fadeOut(300, function(){ $(image).attr('src', '/halcyonic/images/collage_' + imageSize + '_' + randomNumber + '.jpg').bind('onreadystatechange load', function(){ if(image.complete) $(image).fadeIn(300); }); }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload