Sorry not a quiz... I just am having trouble remembering how I built this.
What does this do? firstInt = Number($("div#upsell .upsell_feature_module:visible").attr ("id")); Is it counting where in the chain of Div's the current position is? My code is: function scrollCartUpsells(num){ if (Number(num) == 1){ firstInt = Number($ ("div#upsell .upsell_feature_module:visible").attr("id")); alert(firstInt); nextInt = Number(firstInt) + 1; prevInt = Number(firstInt) - 1; lastInt = Number(firstInt) + Number(spanInt); // lastInt gets display: none; } if (Number(num) == -1){ firstInt = Number($ ("div#upsell .upsell_feature_module:visible").attr("id")) -1; nextInt = Number(firstInt) + 1; prevInt = Number(firstInt) - 1; lastInt = Number(firstInt) + Number(spanInt); // lastInt gets display: none; } // ******** ******** BUTTON VISIBILITY CONTROLS ******** ******** if(Number(firstInt) > 0) { $("#scrollLeft").removeClass("none"); } if(Number(firstInt) <= 1) { $("#scrollLeft").addClass("none"); if(Number($("div#upsell .upsell_feature_module:visible").attr ("id")) == 1){ $("#scrollLeft").removeClass("none"); } } if(Number(lastInt) >= Number(endInt)) { $("#scrollRight").addClass("none"); } if(Number(lastInt) < Number(endInt)) { $("#scrollRight").removeClass("none"); } // ******** ******** BUTTON VISIBILITY CONTROLS ******** ******** if (Number(num) == 1){ $("#"+firstInt).addClass("none"); $("#"+firstInt).css('margin-left', '5px'); $("#"+nextInt).css('margin-left', '40px'); $("#"+lastInt).removeClass("none"); } if (Number(num) == -1){ lastInt = Number(firstInt) + Number(spanInt); $("#"+firstInt).removeClass("none"); $("#"+firstInt).css('margin-left', '40px'); $("#"+nextInt).css('margin-left', '5px'); $("#"+lastInt).addClass("none"); $("#scrollRight").removeClass("none"); } }