title: Reduce and simplify code with conditions and dependencies in jquery?
body: <p>there is a list of images used in a slider. One after the other is active and visible. And there is a clickcounter, witch has nothig to do with the slider. On the 10th image and then after each block of 5 images somthing should happen, only if the clickcounter has a certain value. In this case here something should happen when:</p>
  
  <pre><code>10th image and clickcounters value is 1
  15th image and clickcounters value is 2
  20th image and clickcounters value is 3
  25th image and clickcounters value is 4
  ... and so on. 
  </code></pre>
  
  <p>My jquery looks like this. The images are indexed:</p>
  
  <pre><code>   var num = 5;
     if (instance.index === num*2 &amp;&amp; countCalc == 1 ) {
     do something;
     }
     else if (instance.index === num*3 &amp;&amp; countCalc == 2 ) {
     do something;
     }
     else if (instance.index === num*4 &amp;&amp; countCalc == 3 ) {
    do something;
     };
  </code></pre>
  
  <p>If the variable num ist set to 5, there is a clear relation to the clickcounter. The clickcounter is always the same value like the second multiplicator less 1. I've no idea jet how this shoud be written in one stament, without reapeating the lines for every 5th image. Could anyone please give me a hint? THX </p>