Jquery passing variable problem
<pre><code>    for(var n=0;n&lt;10;n++)
    {
            $('#content-scroll'+n).mousewheel(function(event, delta) {
  if (delta &gt; 0) sliderUp(n-1);
  else if (delta &lt; 0) sliderDown(n-1);
  return false; // prevent default
 });

 n++;
}
</code></pre>

<p>I have a problem with this code, variable "n" is not passed right to the mouswheel function which will add mousewheel only to number 9 (last number) and not to all 10 elements.
Can anyone explain how to pass a variable to this function so that it stays?</p>
