Merge pull request #1116 from ppwwyyxx/patch-2

Fix support for hashes that start with numbers
This commit is contained in:
Ruipeng Zhang 2022-09-16 10:00:20 -04:00 committed by GitHub
commit e59fe64bb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -52,7 +52,8 @@
// jump to location.hash
if (window.location.hash) {
setTimeout(() => {
document.querySelector(window.location.hash).scrollIntoView({ behavior: 'smooth' });
// Use getElementById because querySelector does not support ids that start with numbers
document.getElementById(window.location.hash.substring(1)).scrollIntoView({ behavior: 'smooth' });
}, i * 100);
}
});