Detect Location Bottom using jQuery

$(window).scroll(function() {

  var documentHeight = $(document).height();
  var scrollValue    = $(window).scrollTop();
  var targetBottom   = 1414;

  console.clear();
  console.log(scrollValue + window.innerHeight);
  console.log('default: ' + documentHeight);
  console.log('target : ' + (documentHeight - targetBottom) );

  if (scrollValue + window.innerHeight >= (documentHeight - targetBottom) ) {
    console.log("You are inside of the target bottom");
  }

});

Leave a Reply

Your email address will not be published. Required fields are marked *