A vanilla js library to show preview images on hover see example.
- Add
hover-preview.min.js
to bottom of your body tag.<script defer src='https://raw.githubusercontent.com/AviKKi/hover-preview/main/dist/hover-preview.min.js'></script>
- Add class
hover-preview
toimg
tag that should have preview behaviour.<img src="poster.jpg" class="hover-preview" />
- Add
data-preview
attribute with|
seperated preview image urls.<img src="poster.jpg" class="hover-preview" data-preview="preview1.jpg|preview2.jpg|preview3.jpg" />
$ yarn build