mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-02 01:18:30 +02:00
anchores fix (#967)
This commit is contained in:
@@ -19,17 +19,6 @@ export function scrollIntoViewWithOffset(id, offset) {
|
||||
top: targetPosition,
|
||||
behavior: 'smooth',
|
||||
});
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const scrollHandler = () => {
|
||||
// resolve promise when scroll is finished
|
||||
if (window.scrollY === Math.floor(targetPosition)) {
|
||||
window.removeEventListener('scroll', scrollHandler);
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
window.addEventListener('scroll', scrollHandler);
|
||||
});
|
||||
}
|
||||
|
||||
export function isNodeList(list) {
|
||||
|
||||
@@ -24,9 +24,8 @@ document.addEventListener('DOMContentLoaded', function (event) {
|
||||
const target = anchor.getAttribute('href');
|
||||
anchor.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
scrollIntoViewWithOffset(target.replace('#', ''), offset).then(() => {
|
||||
history.pushState(null, null, target);
|
||||
});
|
||||
history.pushState(null, null, target);
|
||||
scrollIntoViewWithOffset(target.replace('#', ''), offset);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user