javascript - cant get my div to scroll automatically with the content every time a button is clicked -


cant find solutions here on stack overflow. have div element has content added dynamically. div scrollable once amount of content entered div. i'm trying div scroll down automatically each time content added user not have scroll down manually see new content. here html:

<div class="messagecontainer">   <ul class="messagelist">      <li class="messageitem" ng-repeat="message in messages">      message:<input readonly class="messagetext" ng-model="message.text" ng-change="messages.$save(message)"></input>    </li>  </ul> </div> 

use jquery.animate() everytime new element added.

$('.container').animate({     scrolltop: $(".container div:last-child").offset().top; }); 

like so: https://jsfiddle.net/gkehnkdk/4/


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -