link-to-media

Link to img, video, or audio elements

APACHE-2.0 License

Downloads
11
Stars
11
Committers
3

Link to Media Extension and Polyfill

Extension

A browser extension that allows you to link to arbitrary <img>s, <video>s, or <audio>s on webpages, according to the Alternative Content Types proposal.

Polyfill

A polyfill for the proposal to extend the concept of Text Fragments to include media.

Installation of the polyfill

npm install --save link-to-media

Usage

To create a link based on an element:

import { createLink, scrollTo } from 'link-to-media';

const img = document.querySelector('img');
const link = createLink(img);

To scroll the page to an element based on a link:

import { scrollTo } from 'link-to-media';

// This waits for `onload` internally.
scrollTo();

Developing

Scripts

npm run fix
# Beautifies the code.

npm run build
# Builds the polyfill.

npm start
# Runs a local server with test cases.

License

Apache 2.0.

Package Rankings
Top 38.75% on Npmjs.org
Related Projects