css - AngularJS scroll down initial -
i have following div container:
<div class="col-md-8 grid-wrapper-div chathistory"> ... </div>
with css:
.chat .chathistory { overflow-y:scroll; height: 550px; }
and if page loaded scroll bar should @ bottom -> use angularjs. there possibility scroll down css or angularjs
[edit]
i have tried chathistorycontainer.scrollheight undefined. know why?
use nginit, runs upon rendering content , $timeout postpone scrolling next digest cycle in order wait content rendered completely.
<div id="chat_history" class="col-md-8 grid-wrapper-div chathistory" ng-init="scrolltobottom()"> ... </div> myapp .controller(function($scope, $timeout){ $scope.scrolltobottom = function() { $timeout(function(){ var objdiv = document.getelementbyid("chat_history"); objdiv.scrolltop = objdiv.scrollheight; }); }; });
Comments
Post a Comment