My referenced vars keep getting reset to 0, why? Each section has a set of Previous and Next buttons, initially they work fine but when I return to a section the counter for that section is set to 0. It should retain the number it had been set to previously. Thanks in advance. This is not the actual code being used, but it demonstrates the issue ( I hope )
var currentPageIndex = null;
var section1_count = 0;
var section2_count = 0;
var section3_count = 0;
function checkSectionPage( value ){
switch(value){
case "section1":
currentPageIndex= section1_count;
break;
case "section2":
currentPageIndex= section2_count;
break;
case "section3":
currentPageIndex= section3_count;
break;
}
}
$('.slidePrevious').click(function(){
checkSectionPage($(this).parent().attr('id'));
currentPageIndex--;
});
$('.slideNext').click(function(){
checkSectionPage($(this).parent().attr('id'));
currentPageIndex++;
});