fallback from scrollBy() to setting scrollTop on IE11

This commit is contained in:
Bruno Windels 2021-09-13 14:53:08 +02:00
parent 02b8b37b4c
commit 8858cffc55

View file

@ -101,7 +101,11 @@ export class TimelineView extends TemplateView<TimelineViewModel> {
if (newAnchoredBottom !== this.anchoredBottom) {
const bottomDiff = newAnchoredBottom - this.anchoredBottom;
console.log(`restore: scroll by ${bottomDiff} as height changed`);
timeline.scrollBy(0, bottomDiff);
if (typeof timeline.scrollBy === "function") {
timeline.scrollBy(0, bottomDiff);
} else {
timeline.scrollTop = timeline.scrollTop + bottomDiff;
}
this.anchoredBottom = newAnchoredBottom;
} else {
// console.log("restore: bottom didn't change, must be below viewport");