ABHILASH SB
ABHILASH SB

Reputation: 2202

Get an event when scrolls to bottom of a div?

How could I get an event when a div is scrolled to it's bottom? I need to append new data to the div when it is scrolled to the bottom.

Upvotes: 0

Views: 74

Answers (1)

Alfred
Alfred

Reputation: 21406

You may use jQuery's .scroll() event on window, like this:

$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
       $("#div_id").append("New Text");
   }
});

Upvotes: 1

Related Questions