UNPKG

@kddy/vue-scrollactive

Version:

Lightweight and simple to use vue component that highlights menu items as you scroll the page, also scrolling to target section when clicked.

9 lines (6 loc) 257 B
import { getIdFromHash } from './getIdFromHash'; export const getSectionSelector = (element) => { if (element.dataset.sectionSelector) return element.dataset.sectionSelector; if (element.hash) return `#${getIdFromHash(element.hash)}`; return ''; };