Skip to content

Commit

Permalink
Merge pull request #27 from GingerNinjaNicko/patch-1
Browse files Browse the repository at this point in the history
Add null check for activeClass default value (#28)

Closes #28
  • Loading branch information
sidsbrmnn authored May 4, 2024
2 parents 510a448 + c4e9b61 commit 712acde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ScrollSpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ScrollSpy {
targetSelector: options.targetSelector || 'a',
offset: options.offset || 0,
hrefAttribute: options.hrefAttribute || 'href',
activeClass: options.activeClass.trim().split(' ') || ['active'],
activeClass: options.activeClass?.trim().split(' ') || ['active'],
onActive: options.onActive || null,
};
this.sections = document.querySelectorAll(this.options.sectionSelector);
Expand Down

0 comments on commit 712acde

Please sign in to comment.