Fix scroll top calculation on focus event

This commit is contained in:
2020-08-17 18:18:18 +02:00
parent b40d813634
commit da3b16db46

View File

@@ -739,7 +739,10 @@ function focusOnPost(oFocusPost) {
var $Post = oSpot.tmp('$PostList').find(sElemId);
var bGetToTop = (oSpot.tmp('$PostList').height() - (($Post.length > 0)?$Post.position().top:0) >= $(window).height());
if($Post.length > 0 && (bGetToTop || self.tmp('out-of-data'))) {
self.tmp('simple-bar').getScrollElement().scrollTop = $Post.position().top + parseInt($Post.css('margin-top')) + self.tmp('$Poster').outerHeight(true);
self.tmp('simple-bar').getScrollElement().scrollTop =
parseInt($Post.position().top) +
parseInt($Post.css('margin-top')) +
(self.tmp('$Poster').is(':visible')?self.tmp('$Poster').outerHeight(true):0);
if(oFocusPost.type=='media' || oFocusPost.type=='message') $Post.find('a.drill').click();
}
else if(!self.tmp('out-of-data')) updateFeed(false, false, function() {focusOnPost(oFocusPost);});