I have it:
$('#slider li').click(function () { var stepClicked = $(this).index(); alert(stepClicked); if (stepClicked != 0) { $('#cs_previous').removeClass('cs_hideMe'); } else { $('#cs_previous').addClass('cs_hideMe'); } $('li.cs_current').removeClass('cs_current'); $($(this)).addClass('cs_current'); moveToNextImage(stepClicked); function moveToNextImage(stepClicked) { alert(stepClicked); var currentIs = $('li.cs_current').index(); var newLeftEdge = currentIs - stepClicked; $('.cs_riskStageImage').fadeTo(200, .2).animate({ left: newLeftEdge }, "fast").fadeTo(200, 1); }; });
the warning shows the correct index for clicking li, and when I warn the variable in the last function that I call, moveToNextImage(stepClicked) , the same value shows, but the animation does not happen. This works in many other ways, but I'm trying to pass in the index value of the list item that needs to be used to calculate math.
.. or can I convert the value to another variable in the first function, which I can pass to the second?
source share