first try instant scrolling, then delayed

This commit is contained in:
Tor Hveem 2013-10-16 23:59:27 +02:00
parent 96a96af7c8
commit f5088d54b0

View file

@ -342,14 +342,16 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.scrollToBottom = function() { $rootScope.scrollToBottom = function() {
// FIXME doesn't work if the settimeout runs without a short delay // FIXME doesn't work if the settimeout runs without a short delay
// 300 ms seems to do the trick but creates a noticable flickr // 300 ms seems to do the trick but creates a noticable flickr
$timeout(function() { var scroll = function() {
var readmarker = document.getElementById('readmarker'); var readmarker = document.getElementById('readmarker');
if(readmarker) { if(readmarker) {
readmarker.scrollIntoView(); readmarker.scrollIntoView();
}else{ }else{
window.scroll(0, document.documentElement.scrollHeight - document.documentElement.clientHeight); window.scroll(0, document.documentElement.scrollHeight - document.documentElement.clientHeight);
} }
}, 300); }
scroll();
$timeout(scroll, 300);
} }
$scope.sendMessage = function() { $scope.sendMessage = function() {