title: Make fade in-out effect runs infinite (pure JS, not jQuery)
body: <p>I was searching a script to make a div to fade in and out, and found this question <a href="https://stackoverflow.com/questions/28662893/fade-in-and-fade-out-in-pure-javascript-without-jquery">fade in and fade out in pure javascript without jquery</a> </p>
  
  <p>User <em>bgoldst</em> gave a nice solution that worked for me. But I would need the fade in-out to run in loop, not just once as stated by bgoldst's code. I'm totally new at JS and don't know how to get it to work, any suggestion?</p>
  
  <p>EDIT: I have found a intermediate solution with Luke's suggestion and Kai's suggestions from <a href="https://stackoverflow.com/questions/23244338/pure-javascript-fade-in-function">Pure JavaScript fade in function</a></p>
  
  <p>That is</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var div = document.getElementById("foo");
  
      setInterval(function() {
          div.style.transition="opacity 1.5s";
          div.style.opacity=0;
      }, 1500);
  
      setInterval(function() {
          div.style.transition="opacity 1.5s";
          div.style.opacity=1;
      }, 3005);
  &lt;/script&gt;
  </code></pre>
  
  <p>However, the fade in/out effect doesn't  have a symmetric behaviour.</p>