Skip to content

Commit

Permalink
fix: #12 Custom active class not removed for previously selected menu…
Browse files Browse the repository at this point in the history
… items (#13)
  • Loading branch information
jbardon committed Sep 30, 2020
1 parent 77958bc commit 1cec086
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scrollspy.js
Expand Up @@ -53,8 +53,8 @@ export class ScrollSpy {
}

removeCurrentActive({ ignore }) {
const { hrefAttribute, menuActiveTarget } = this.options
const items = `${menuActiveTarget}.active:not([${hrefAttribute}="${ignore.getAttribute(hrefAttribute)}"])`
const { hrefAttribute, menuActiveTarget, activeClass } = this.options
const items = `${menuActiveTarget}.${activeClass}:not([${hrefAttribute}="${ignore.getAttribute(hrefAttribute)}"])`
const menuItems = this.menuList.querySelectorAll(items)

menuItems.forEach((item) => item.classList.remove(this.options.activeClass))
Expand Down

0 comments on commit 1cec086

Please sign in to comment.