title: Stop loop function on a button's click
body: <p>I've a series of arrays  which I'm displaying one after another using jquery loop. </p>
  
  <p>Check <a href="http://jsfiddle.net/ramansharma89/fcLso5c9/3/" rel="nofollow">JSFiddle Demo</a>. </p>
  
  <p>Now I want to stop it when a user click on "stop it now" button.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;h1&gt;Lorem ipsumd dolor sit amet.&lt;/h1&gt;
  &lt;div id="div1"&gt;Answer One&lt;/div&gt;
  &lt;div class="stop"&gt;
      &lt;button&gt;Stop it Now.&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>body{text-align:center;}
  h1{padding:30px; margin:0 0 0 30px;}
  #div1{padding:20px;margin-top:0; text-align:center;}
  </code></pre>
  
  <p>jQuery</p>
  
  <pre><code>$(document).ready(function() {
  
  var items = ["Answer Two", "Answer Three", "Answer Four", "Answer Five", "Answer Six", "Answer One"],
      $text = $( '#div1' ),
      delay = .2; //seconds
  
  function loop ( delay ) {
      $.each( items, function ( i, elm ){
          $text.delay( delay*1E3).hide();
          $text.queue(function(){
              $text.html( items[i] );
              $text.dequeue();
          });
          $text.show();
          $text.queue(function(){
              if ( i == items.length -1 ) {
                  loop(delay);   
              }
              $text.dequeue();
          });
      });
  }
  
  loop( delay );
  });
  </code></pre>
  
  <p>How can I achieve this?</p>