Skip to content

Commit 6999058

Browse files
committed
Scroll the window to the top after replacing the body content.
1 parent de697df commit 6999058

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Scripts/hydro.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
let newContent = doc.querySelector(selector);
4343
let newTitle = doc.querySelector('head>title');
4444
element.innerHTML = newContent.innerHTML;
45+
46+
if (selector === 'body'){
47+
window.scrollTo(0, 0);
48+
}
4549

4650
if (newTitle) {
4751
document.title = newTitle.textContent;

0 commit comments

Comments
 (0)