From f5088d54b0275a9800d56857a8c132851dcd1237 Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Wed, 16 Oct 2013 23:59:27 +0200 Subject: [PATCH] first try instant scrolling, then delayed --- js/websockets.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/websockets.js b/js/websockets.js index a02962e..d5578f7 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -342,14 +342,16 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $rootScope.scrollToBottom = function() { // FIXME doesn't work if the settimeout runs without a short delay // 300 ms seems to do the trick but creates a noticable flickr - $timeout(function() { + var scroll = function() { var readmarker = document.getElementById('readmarker'); if(readmarker) { readmarker.scrollIntoView(); }else{ window.scroll(0, document.documentElement.scrollHeight - document.documentElement.clientHeight); } - }, 300); + } + scroll(); + $timeout(scroll, 300); } $scope.sendMessage = function() {