Scroll menu does not let Jquery javascript go up

0

I have the following form

<div class="container">
<div class="row" >
    <div class="panel panel-default">
      <div class="panel-heading">ADAPTOR CHATBOT</div>
      <div class="panel-body">
        <div class="container" id="contenedor" style="overflow-y: auto; height:500px;">
            <div class="row message-bubble"><p class="text-muted">Adaptor ChatBot</p><p>Hola! para que te podamos ayudar debes introducir la palabra usuario seguido de tu nombre de usuario y la palabra password seguida de tu password</p></div>
        </div>
        <div class="panel-footer">
             <div class="input-group">
              <input type="text" class="form-control" id="txtChat" onkeypress="return runScript(event)" >
              <span class="input-group-btn">
                <button onclick="charla()" class="btn btn-default" type="button">Enviar</button>
              </span>
            </div>
        </div>
      </div>
    </div>
</div>

with the following function

    function ScrollView(){ 
    setInterval(function(){if(window.parar)return;document.getElementById('contenedor').scrollTop=document.getElementById('contenedor').scrollHeight},30); 

     } 

the issue is that if you scroll down automatically, but it does not allow me to upload the scroll up again, since thank you

Javascript or Jquery serves me

    
asked by Bruno Sosa Fast Tag 22.09.2017 в 14:16
source

2 answers

3

Try removing the setInterval , since it is running every 0.03 seconds (3000 = 3 seconds).

function ScrollView(){ 
    function(){
      if(window.parar)
        return;
      document.getElementById('contenedor').scrollTop=document.getElementById('contenedor').scrollHeight
    }; 
}

Call the ScrollView() function only when you need it (someone type in the chat, in your case), instead of letting it run every so soon.

    
answered by 22.09.2017 / 14:34
source
1

The same thing happened to me and I solved it by adding an end of animation event in each case:

$('html, body').animate({scrollTop: 0},1000);

$('html,body').animate(nulla);
});
    
answered by 27.03.2018 в 04:53