Issue with a logical condition to find the value lies in which logical set
<p>We have a generic slider functionality implemented in our product. We need to read the item index value from URL and scroll the slider to show the active item. </p>

<p>Following code logic is used to show the active thumbnail and for that i need to animate the DIV to negative left. </p>

<p>First, we get the total thumbnail items and then index of active item from URL Hash Value (i.e. #slide=7). One set contains minimum of 5 items. Need to multiply the slider width to the page set value where ActiveItemIndex lies.</p>

<p>Javascript Code - </p>

<pre><code>showActiveThumbnailOnPageLoad : function() {
    var _this = this,
        totalThumbnails = $('.slidetabs a').length,
        activeItem = window.location.href.split('=')[1],
        scrollAmount;

    if(activeItem &gt; 5 &amp;&amp; activeItem &lt;= 10) {
        scrollAmount = '-=' + 772
    } else if(activeItem &gt; 10 &amp;&amp; activeItem &lt;= 15) {
        scrollAmount = '-=' + 772 * 2
    } else if(activeItem &gt; 15 &amp;&amp; activeItem &lt;= 20) {
        scrollAmount = '-=' + 772 * 3
    }

    $('.slidetabs').stop().animate({
        left : scrollAmount
    });
}
</code></pre>

<p>As of now, hard code condition is used which support upto 20 items. Any help to make this code to support n number of items. I mean to say a generic code without hard code values.</p>

<p>Thanks in advance.</p>
