Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Edit 1:</strong> Wrote a customizable loader so you can register/un-register loaders.. See below,</p> <p><strong>Edit 2:</strong> As Vision pointed out </p> <blockquote> <p>Just out of interest... I thought, what is the point to create multiple timers and store them in the array? If you wait for some time, the separate timers will desynchronize. How about this: jsfiddle.net/rMpK9/5</p> </blockquote> <p><strong>Improved Code:</strong> (From Vision's <a href="http://jsfiddle.net/rMpK9/5" rel="nofollow">DEMO</a> and use of <code>getElementsByTagName</code>)</p> <pre><code>var timer = null, dotLimit = 3, elements = []; function registerProgressDots(progress) { for (var i = 0; i &lt; progress.length; i++) { elements.push(progress[i]); } timer = setInterval(function() { for (var i = 0; i &lt; elements.length; i++) { with(elements[i]) { innerHTML = innerHTML.length == dotLimit ? '' : innerHTML + '.'; } } }, 200); } function unRegisterProgressDots(index, clearDots) { if (typeof index == 'undefined' || index == null) { clearInterval(timer); } else { elements.splice(index, 1); if (elements.length == 0) { clearInterval(timer); } } if (clearDots) { var progress = document.getElementsByClassName('progressDots'); for (var i = 0; i &lt; progress.length; i++) { progress[i].innerHTML = ''; } } } window.setTimeout(function() { var spanTags = document.getElementsByTagName('span'); var progress = []; for (var i = 0; i &lt; spanTags.length; i++) { if (spanTags[i].className.indexOf('progressDots') &gt;= 0) { progress.push(spanTags[i]); } } registerProgressDots(progress); }, 100); window.setTimeout(function() { unRegisterProgressDots(null, true); }, 10000); //stop loading text after 10 seconds </code></pre> <p><a href="http://jsfiddle.net/rMpK9/6/" rel="nofollow"><strong>Final DEMO</strong></a></p>
 

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