[Fix] scrollspy detection & default hightlight
This commit is contained in:
@@ -8,10 +8,10 @@ const ScrollSpyDirective: DirectiveOptions = {
|
|||||||
selectors = binding.value.selectors;
|
selectors = binding.value.selectors;
|
||||||
|
|
||||||
// highlight first element
|
// highlight first element
|
||||||
el.querySelector(`[href="${location.hash || selectors[0] || ''}"]`)?.classList.toggle('active', true);
|
el.querySelector(`[href="${selectors[0] || ''}"]`)?.classList.toggle('active', true);
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
rootMargin: '-10% 0px -80% 0px',
|
rootMargin: '-5% 0px -85% 0px',
|
||||||
threshold: 0
|
threshold: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user