Trying to improve scrolling. Still not elegant

This commit is contained in:
Tor Hveem 2013-10-22 19:58:12 +02:00
parent 6b3ab23dcc
commit a505c146f2
1 changed files with 10 additions and 4 deletions

View File

@ -425,17 +425,23 @@ 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
var scroll = function() {
var readmarker = document.getElementById('readmarker');
if(readmarker) {
readmarker.scrollIntoView();
}else{
window.scroll(0, document.documentElement.scrollHeight - document.documentElement.clientHeight);
var sTop = document.documentElement.scrollTop;
var sVal = document.documentElement.scrollHeight - document.documentElement.clientHeight;
if(sTop < sVal) {
document.documentElement.scrollTop = sVal;
}
}
scroll();
}
// Here be scrolling dragons
$timeout(scroll);
$timeout(scroll, 100);
$timeout(scroll, 300);
$timeout(scroll, 500);
}
$scope.sendMessage = function() {