-2

I have a footer which is hidden by default and I want the footer to appear when the user reached the bottom of the page and while scrolling either up and down the footer changes its height, but I don't really know how to do that. Is there some kind of onmousewheel-event which detects when the user scrolls up or down?

Any suggestions are welcome...

JSFiddle

isherwood
  • 58,414
  • 16
  • 114
  • 157
ST80
  • 3,565
  • 16
  • 64
  • 124
  • 1
    I think this could help you. [link](https://stackoverflow.com/questions/14926366/mousewheel-event-in-modern-browsers) – Jirka Vrba Jan 29 '18 at 20:20

1 Answers1

0

If you can use jQuery, its easy to detect scroll position. For example:

$(window).on("scroll", function() {
    var scrollHeight = $(document).height();
    var scrollPosition = $(window).height() + $(window).scrollTop();
    if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
        //bottom of the page
    }
});
ibrahimyilmaz
  • 2,317
  • 1
  • 24
  • 28