Check for element before scrolling
This commit is contained in:
parent
2ee29923c1
commit
9a1bcf0cc0
1 changed files with 4 additions and 1 deletions
|
@ -449,7 +449,10 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
// 300 ms seems to do the trick but creates a noticable flickr
|
||||
$timeout(function() {
|
||||
// TODO in the future, implement scrolling to last read line
|
||||
window.scrollTo(0, document.querySelector('.bufferline:last-child').offsetTop);
|
||||
var lastline = document.querySelector('.bufferline:last-child');
|
||||
if(lastline) {
|
||||
window.scrollTo(0, lastline.offsetTop);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue