Fix scroll top calculation on focus event

This commit is contained in:
2020-08-17 18:18:18 +02:00
parent 94892a2a90
commit 4c4f83b6a2

View File

@@ -739,7 +739,10 @@ function focusOnPost(oFocusPost) {
var $Post = oSpot.tmp('$PostList').find(sElemId); var $Post = oSpot.tmp('$PostList').find(sElemId);
var bGetToTop = (oSpot.tmp('$PostList').height() - (($Post.length > 0)?$Post.position().top:0) >= $(window).height()); 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'))) { 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(); 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);}); else if(!self.tmp('out-of-data')) updateFeed(false, false, function() {focusOnPost(oFocusPost);});