iron out some kinks with scrollToItem() in combination with collapsed content and images

This commit is contained in:
Mario Vavti 2019-03-01 14:16:19 +01:00
parent de7f2eef47
commit 2244bf2ba2

View File

@ -770,7 +770,7 @@ function updateConvItems(mode,data) {
mediaPlaying = false; mediaPlaying = false;
}); });
var bimgs = ((preloadImages) ? false : $(".wall-item-body img, .wall-photo-item img").not(function() { return this.complete; })); var bimgs = $(".wall-item-body img, .wall-photo-item img").not(function() { return this.complete; });
var bimgcount = bimgs.length; var bimgcount = bimgs.length;
if (bimgcount) { if (bimgcount) {
@ -778,17 +778,23 @@ function updateConvItems(mode,data) {
bimgcount--; bimgcount--;
if (! bimgcount) { if (! bimgcount) {
collapseHeight(); collapseHeight();
}
});
} else {
collapseHeight();
}
if(bParam_mid && mode === 'replace') if(bParam_mid && mode === 'replace')
scrollToItem(); scrollToItem();
$(document.body).trigger("sticky_kit:recalc"); $(document.body).trigger("sticky_kit:recalc");
} }
});
} else {
collapseHeight();
if(bParam_mid && mode === 'replace')
scrollToItem();
$(document.body).trigger("sticky_kit:recalc");
}
}
function scrollToItem() { function scrollToItem() {
// auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode