Skip to content

Commit 16931c2

Browse files
committed
In the PDF viewer plugin, use offsetTop to scroll pages instead of
window.scrollIntoView, because that can also scroll the parent of the iframe the viewer is in.
1 parent aa7966b commit 16931c2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

PDFViewerPlugin.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ function PDFViewerPlugin() {
8585
pageHeight,
8686
createdPageCount = 0;
8787

88+
function scrollIntoView(elem) {
89+
elem.parentNode.scrollTop = elem.offsetTop;
90+
}
91+
8892
function isScrolledIntoView(elem) {
8993
var docViewTop = container.scrollTop,
9094
docViewBottom = docViewTop + container.clientHeight,
@@ -311,6 +315,6 @@ function PDFViewerPlugin() {
311315
};
312316

313317
this.showPage = function (n) {
314-
domPages[n - 1].scrollIntoView();
318+
scrollIntoView(domPages[n - 1]);
315319
};
316320
}

0 commit comments

Comments
 (0)