Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 993 Bytes

readme.md

File metadata and controls

42 lines (26 loc) · 993 Bytes

Hover Preview

A vanilla js library to show preview images on hover, check a Demo here

Please watch 👀 or star 🌟 this repo if you like it.

preview

Getting started

  1. Grab the minified js code, from here.

  2. Add hover-preview.min.js to bottom of your body tag, example -

    <script defer src='/js/hover-preview.min.js'></script>
  3. Add class hover-preview to img tag that should have preview behaviour.

    <img src="poster.jpg" class="hover-preview" />
  4. Add data-preview attribute with pipe(|) seperated preview image urls, example

    <img
      src="poster.jpg"
      class="hover-preview"
      data-preview="preview1.jpg|preview2.jpg|preview3.jpg"
    />

Build minified bundle

$ yarn build