npm install preload-hover
Or, load this script manually: https://unpkg.com/preload-hover@latest/lib/preload-hover.min.js -- This targets the latest version, which may include breaking changes for major version updates. A specific version can be targeted to avoid potential breaking changes. See https://unpkg.com for more information.
new PreloadHover().start();
- Run
new PreloadHover().start();
, optionally specifying the scope in the parameter (defaults todocument.body
).
Configuration options can be specified in the PreloadHover
constructor. Example:
new PreloadHover({
defaultDomScope: document.getElementById('preload-container')
}).start();
Option | Description | Default Value |
---|---|---|
defaultDomScope |
The default DOM scopes to use. | [document.body ] |
debounceTime |
The time in milliseconds to wait before adding preload link. | 50 |
linkType |
The types of links to include. ('local' , 'external' , 'both' ) |
'local' |
Activate preload on hover for a
tags inside domScopes
.
npm install
npm start
to run demo.npm run build
ornpm run watch
npm test
ornpm run test:watch
to run tests.npm run lint
to run linter.npm run validate
to run linter followed by tests.
MIT