25 lines
602 B
JavaScript
25 lines
602 B
JavaScript
"use strict";
|
|
|
|
/* ===== Smooth scrolling ====== */
|
|
/* Note: You need to include smoothscroll.min.js (smooth scroll behavior polyfill) on the page to cover some browsers */
|
|
/* Ref: https://github.com/iamdustan/smoothscroll */
|
|
|
|
const pageNavLinks = document.querySelectorAll('.scrollto');
|
|
|
|
pageNavLinks.forEach((pageNavLink) => {
|
|
|
|
pageNavLink.addEventListener('click', (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
var target = pageNavLink.getAttribute("href").replace('#', '');
|
|
|
|
//console.log(target);
|
|
|
|
document.getElementById(target).scrollIntoView({ behavior: 'smooth' });
|
|
|
|
|
|
});
|
|
|
|
});
|