FEATURE Handle self page scrolling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3418325d03
commit
a762d15768
|
|
@ -1,8 +1,10 @@
|
|||
import menuInit from './header';
|
||||
import initFooterShapes from './footer';
|
||||
import handleScrollTop from './utilities/scroll-top';
|
||||
import handleInsidePageScrolling from './page-scrolling';
|
||||
window.addEventListener('load', function () {
|
||||
// menuInit();
|
||||
initFooterShapes();
|
||||
handleScrollTop();
|
||||
handleInsidePageScrolling();
|
||||
});
|
||||
|
|
|
|||
11
resources/js/page-scrolling.ts
Normal file
11
resources/js/page-scrolling.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export default function HandleInsidePageScrolling() {
|
||||
const insideLinks = document.querySelectorAll('a[href^="#"]');
|
||||
|
||||
insideLinks.forEach((link) => {
|
||||
link.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const target = document.querySelector(link.getAttribute('href'));
|
||||
target?.scrollIntoView({ behavior: 'smooth' });
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user