for (var n = 0; n < 10; n++) {
$('#content-scroll' + n).mousewheel(function(event, delta) {
if (delta > 0) sliderUp(n - 1);
else if (delta < 0) sliderDown(n - 1);
return false; // prevent default
});
n++;
}
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?