Files
docuseal/app/javascript/elements/menu_active.js
T
2026-09-23 11:00:17 +03:00

12 lines
370 B
JavaScript

export default class extends HTMLElement {
connectedCallback () {
this.id = `menu-active-${Math.random().toString(32).split('.')[1]}`
this.querySelectorAll('a').forEach((link) => {
if (document.location.pathname.startsWith(link.pathname) && !link.getAttribute('href').startsWith('http')) {
link.classList.add('bg-base-300')
}
})
}
}