fix(plugin): check if scroll target exists in animation plugin
parent
e59fe64bb1
commit
436e134d5a
|
@ -52,8 +52,11 @@
|
|||
// jump to location.hash
|
||||
if (window.location.hash) {
|
||||
setTimeout(() => {
|
||||
// Use getElementById because querySelector does not support ids that start with numbers
|
||||
document.getElementById(window.location.hash.substring(1)).scrollIntoView({ behavior: 'smooth' });
|
||||
const id = '#' + CSS.escape(window.location.hash.substring(1));
|
||||
const target = document.querySelector(id);
|
||||
if (target) {
|
||||
target.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
}, i * 100);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue