Jump to content
Fórum Script Brasil
  • 0

[RESOLVIDO]Erro ao reconhecer quando a barra de rolagem chega ao final


Renan Carvalho

Question

Pessoal, esta acontecendo o contrario do que eu gostaria, a pagina está mandando o alerta quando a barra de rolagem é posta no inicio, e não no final.

window.onscroll = load_more;
                         var page = 1; //Número da página já exibida

                         function load_more(){

                                 var doc_h = document.body.scrollHeight;

                                 var win_h = document.body.clientHeight;

                                 var d = doc_h-win_h;

                                 var nom = navigator.appName;
                                 if (nom == "Microsoft Internet Explorer"){
                                         var yOffset = document.body.scrollTop; //WINDOW SCROLLBAR Y OFFSET
                                 }else{
                                         var yOffset = window.pageYOffset; //WINDOW SCROLLBAR Y OFFSET
                                 }
                                 $("#loading").html("<img src='loading.gif'>");
                                 if(yOffset==d){
                                         alert ("Cheguei ao final da pagina!");
                        
                                 }
                         }

Fico muito grato se puderem me ajudar! Obrigado

Edited by Renan Carvalho
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...