Try fixing scrolling bug...

This commit is contained in:
octospacc 2024-01-13 20:59:23 +01:00
parent 7f9cfaa8ef
commit 8003ff319c
2 changed files with 15 additions and 15 deletions

View File

@ -13,19 +13,19 @@ let MbState = {};
// <https://stackoverflow.com/questions/29956338/how-to-accurately-determine-if-an-element-is-scrollable/71170105#71170105>
function CanScrollEl(el, scrollAxis) {
if (0 === el[scrollAxis]) {
el[scrollAxis] = 1;
if (1 === el[scrollAxis]) {
el[scrollAxis] = 0;
return true;
}
} else {
return true;
}
return false;
if (0 === el[scrollAxis]) {
el[scrollAxis] = 1;
if (1 === el[scrollAxis]) {
el[scrollAxis] = 0;
return true;
}
} else {
return true;
}
return false;
}
function IsScrollableY(el) {
return (el.scrollHeight > el.clientHeight) && CanScrollEl(el, 'scrollTop') && ('hidden' !== getComputedStyle(el).overflowY);
return (el.scrollHeight > el.clientHeight) && CanScrollEl(el, 'scrollTop') && ('hidden' !== getComputedStyle(el).overflowY);
}
function GetDomainFromUrl (url) {

View File

@ -324,13 +324,13 @@ var TWeb = {
}
var time3 = +(new Date);
//console.log('inserted ' + (time3 - time2) + 'ms');
if (scrollToLast) {
//$('#BottomAnchor')[0].scrollIntoView();
$('.tgme_widget_message_wrap').last().scrollIntoView();
}
if (!IsScrollableY($('html')[0])) {
TWeb.loadMore($('.js-messages_more_wrap > a'), true);
}
if (scrollToLast) {
$('#BottomAnchor')[0].scrollIntoView();
$('.tgme_widget_message_wrap').last().scrollIntoView();
}
},
error: function(data) {
var timeout = $moreEl.data('timeout') || 1000;