title: Next and Previous Slide Button Functionality i++, i--
body: <p>I had a great experience asking a question last time and thought I'd come back for more help.  You guys are wonderful.  Thank you in advance.</p>
  
  <p>I am working with a featured post slider that advances through 4 posts automatically.  I would like to add next and previous buttons.  I know that I need to attach some kind of .click() event to #movers-next and #movers-previous but everything I've tried so far has resulted in spotty performance.</p>
  
  <p>Can you please help me code a stable method of looping through variable 'curclicked'?
  (NOTE: .stripNav ul li a is auto-generated by the plugin as a means of looping through posts)</p>
  
  <p>Thank You.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  var theInt = null;
  var $crosslink, $navthumb;
  var curclicked = 0;
  
  theInterval = function(cur){
   clearInterval(theInt);
  
   if( typeof cur != 'undefined' )
    curclicked = cur;
  
   $crosslink.removeClass("active-thumb");
   $navthumb.eq(curclicked).parent().addClass("active-thumb");
    jQuery(".stripNav ul li a").eq(curclicked).trigger('click');
  
   theInt = setInterval(function(){
    $crosslink.removeClass("active-thumb");
    $navthumb.eq(curclicked).parent().addClass("active-thumb");
    jQuery(".stripNav ul li a").eq(curclicked).trigger('click');
    curclicked++;
    if( 6 == curclicked )
     curclicked = 0;
  
   }, 8000);
  };
  
  
  
  jQuery(function(){
  
   jQuery("#main-photo-slider").codaSlider();
  
   $navthumb = jQuery(".nav-thumb");
   $crosslink = jQuery(".cross-link");
  
   $navthumb
   .click(function() {
    var $this = jQuery(this);
    theInterval($this.parent().attr('href').slice(1) - 1);
    return false;
   });
  
   theInterval();
  });
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;div id="page-wrap"&gt;
  &lt;div class="slider-wrap"&gt;
   &lt;div id="main-photo-slider" class="csw"&gt;
    &lt;div class="panelContainer"&gt;
  
  &lt;div class="panel" title="Panel 1"&gt;
   &lt;div class="wrapper"&gt;
    &lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387907thai_cuisine.jpg' /&gt;      &lt;div class="photo-meta-data"&gt;
     Etiam eu mauris augue       &lt;p&gt;Suscipit a aliquet a, gravida non erat. Integer euismod felis nec&amp;#8230;&lt;/p&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="panel" title="Panel 2"&gt;
   &lt;div class="wrapper"&gt;
    &lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387756EthnicCuisine.jpg' /&gt;      &lt;div class="photo-meta-data"&gt;
     Etiam eu mauris augue       &lt;p&gt;Suscipit a aliquet a, gravida non erat. Integer euismod felis nec&amp;#8230;&lt;/p&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="panel" title="Panel 3"&gt;
   &lt;div class="wrapper"&gt;
    &lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257386373slider-primary.jpg' /&gt;      &lt;div class="photo-meta-data"&gt;
     Etiam eu mauris augue       &lt;p&gt;Suscipit a aliquet a, gravida non erat. Integer euismod felis nec&amp;#8230;&lt;/p&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="panel" title="Panel 4"&gt;
   &lt;div class="wrapper"&gt;
    &lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387711cuisine.jpg' /&gt;      &lt;div class="photo-meta-data"&gt;
     Etiam eu mauris augue       &lt;p&gt;Suscipit a aliquet a, gravida non erat. Integer euismod felis nec&amp;#8230;&lt;/p&gt;
      &lt;/div&gt;
     &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div id="movers-row"&gt;
  &lt;a id="movers-previous" href="#"&gt;&lt;img src="http://thevarsitysquad.com/wordpress/love2eat/wp-content/themes/eater/img/slider-button-previous.gif" /&gt;&lt;/a&gt;
   &lt;div&gt;&lt;a href="#1" class="cross-link"&gt;&lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387907thai_cuisine.jpg' /&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;div&gt;&lt;a href="#2" class="cross-link"&gt;&lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387756EthnicCuisine.jpg' /&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;div&gt;&lt;a href="#3" class="cross-link"&gt;&lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257386373slider-primary.jpg' /&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;div&gt;&lt;a href="#4" class="cross-link"&gt;&lt;img src='http://thevarsitysquad.com/wordpress/love2eat/wp-content/files_flutter/th_b700d8c1271c49208e0f9230a1a215f2_1257387711cuisine.jpg' /&gt;&lt;/a&gt;&lt;/div&gt;
   &lt;a id="movers-next" href="#"&gt;&lt;img src="http://thevarsitysquad.com/wordpress/love2eat/wp-content/themes/eater/img/slider-button-next.jpg" /&gt;&lt;/a&gt;
   &lt;/div&gt;
  
   &lt;/div&gt;
   &lt;/div&gt;  
  </code></pre>