Initial commit - Admin Template HTML
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
function initScrollSpy() {
|
||||
const observer = new IntersectionObserver(function (entries) {
|
||||
entries.forEach(function (e) {
|
||||
if (e.isIntersecting) {
|
||||
document.querySelectorAll('.nav-link').forEach(function (l) { l.classList.remove('active'); });
|
||||
var el = document.querySelector('.nav-link[href="#' + e.target.id + '"]');
|
||||
if (el) el.classList.add('active');
|
||||
}
|
||||
});
|
||||
}, { rootMargin: '-80px 0px -50% 0px' });
|
||||
document.querySelectorAll('section[id]').forEach(function (s) { observer.observe(s); });
|
||||
}
|
||||
Reference in New Issue
Block a user