I am trying to add a feature to scroll up and down a div based on button click. I was able to do the scroll down part easily, but got stuck wit the scroll up part and one mo
Where did it come from scrollBottom
this is not a valid property it should be scrollTop
and this can be positive(+
) or negative(-
) values to scroll down(+
) and up(-
), so you can change:
scrollBottom
to this scrollTop
:
$("#upClick").on("click", function () {
scrolled = scrolled - 300;
$(".cover").animate({
scrollTop: scrolled
});//^^^^^^^^------------------------------this one
});