I have this:
$('#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 alert shows the proper index for the li clicked, and when I alert the variable within the last function I'm calling, moveToNextImage(stepClicked)
, the same value shows but the animation isn't happening. This works many other ways, but I'm trying to pass the index value of the list item clicked to use for the math to calculate.
..or can I convert the value to another variable in the first function that I can pass to the second?