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