Web component / unpkg

<img-enlarge>

Load the component from unpkg. See the README for installation and API details.

Import automatic registration

Import define.js to register img-enlarge automatically. You don’t need a separate customElements.define() call. If the CDN can’t load, the image remains visible.

<script type="module">
  import 'https://unpkg.com/@aarongustafson/img-enlarge/define.js?module';
</script>

<img-enlarge>
  <img src="./mountains.svg" alt="A trail through green mountains.">
</img-enlarge>
A trail through green mountains.