Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brunohaveroth/513ed9d45564360bdd48 to your computer and use it in GitHub Desktop.
Save brunohaveroth/513ed9d45564360bdd48 to your computer and use it in GitHub Desktop.
$(document).scroll(function() {
var top = document.body.scrollTop;
var maxTop = document.body.scrollHeight - document.body.clientHeight;
if (parseInt(top) === maxTop) {
console.log('Chegou ao fim da página')
}
});
@pittersnider
Copy link

Ao topo da página, não ao fim.

@renatovieiradesouza
Copy link

renatovieiradesouza commented Jul 18, 2017

Queria implementar um simples contador mas ele não incrementa de modo algum.

`$(document).scroll(function() {
var top = document.body.scrollTop;
var maxTop = document.body.scrollHeight - document.body.clientHeight;
var contadorRolagemPg = 0;

if (parseInt(top) === maxTop) {     
  contadorRolagemPg += 1
  console.log(contadorRolagemPg);
}

});`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment