Now I know I can use scrollTop()
, but that gets me the amount of pixels from the top of the screen. Would it be possible to get the amount of px
from the bottom part of the screen to top?
Asked
Active
Viewed 558 times
0
1 Answers
2
Just assign a variable to a function with the properties similar to scrollTop (but opposite) like this:
$.fn.scrollBottom = function() {
return $(document).height() - this.scrollTop() - this.height();
};
Then just call it as follows:
$(window).scrollBottom(); //how many pixels below current view
$("#elem").scrollBottom(); //how many pixels below element