Skip to content

Commit 688d23b

Browse files
committed
fix bookmark on mobile scroll to begin error
1 parent a35604c commit 688d23b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

static/js/custom.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,15 @@ async function html2Img(html) {
154154
addQRPart(footer);
155155
div.appendChild(footer);
156156
let bodyBackup = document.body;
157+
let postionBackup = window.pageYOffset || document.documentElement.scrollTop;
157158
if (window.mobileCheck()) {
158159
document.body = document.createElement("body");
159160
}
160161
document.body.appendChild(div);
161162
let canvas = await html2canvas(div, {allowTaint: true, useCORS: true});
162163
if (window.mobileCheck()) {
163164
document.body = bodyBackup;
165+
window.scrollTo(0, postionBackup);
164166
} else {
165167
document.body.removeChild(div);
166168
}

0 commit comments

Comments
 (0)