I'm using an UP button(upArrow
) and a DOWN button (downArrow
) to scroll a div. The code works fine. Below is the code set for those 2 buttons.
My question is, how do I join this when someone uses the mouse wheel to scroll?
Example: If someone uses the downArrow
button to scroll down and reach at the bottom a pop-up shows ( if( val == (items) ){ //reasched end - now do something... }
). Now how do I make the popup show if someone uses the mouse wheel and instead of the buttons?
var numVal = 0,
val = 0,
items = 12,
scrollVal = 300;
$('#downArrow').click(function() {
numVal = numVal+scrollVal;
val++;
$("#itHolder").animate({
scrollTop: numVal
});
if( val == (items) ){
//reasched end - now do something...
}
});
$('#upArrow').click(function() {
numVal = numVal-scrollVal;
val--;
$("#itHolder").animate({
scrollTop: numVal
});
if( val == 0 ){
//reasched top - now do something...
}
});