Automatically adds anchors to elements.
Installation
npm install toc-anchor
Usage
In your project import the library:
;
Import default styles.
TocAnchor(selector, [anchorContent])
Initializes anchor library. Both the first and second argument can either be a selector, DOM node, or a collection of DOM Nodes.
Parameters
selector
{string|Element|NodeList} - Selector to which anchors will be added
[anchorContent]
{string|Element|NodeList} - Content to be included as anchor, if no provided a clip icon will be added by default
Returns
Array
- Array containing the elements to which anchors where added
Example
const els = ;