Fixed not-scrolling-not-loading bug for MBViewer
This commit is contained in:
parent
da9531e616
commit
7f9cfaa8ef
|
@ -11,6 +11,23 @@
|
|||
|
||||
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;
|
||||
}
|
||||
function IsScrollableY(el) {
|
||||
return (el.scrollHeight > el.clientHeight) && CanScrollEl(el, 'scrollTop') && ('hidden' !== getComputedStyle(el).overflowY);
|
||||
}
|
||||
|
||||
function GetDomainFromUrl (url) {
|
||||
return url.split('//')[1].split('/')[0];
|
||||
}
|
||||
|
|
|
@ -328,6 +328,9 @@ var TWeb = {
|
|||
//$('#BottomAnchor')[0].scrollIntoView();
|
||||
$('.tgme_widget_message_wrap').last().scrollIntoView();
|
||||
}
|
||||
if (!IsScrollableY($('html')[0])) {
|
||||
TWeb.loadMore($('.js-messages_more_wrap > a'), true);
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
var timeout = $moreEl.data('timeout') || 1000;
|
||||
|
|
Loading…
Reference in New Issue