Preview Image And Video Links – A simple plugin that adds photo and video previews to any element. A useless easy image & video preview plugin that shows photos and HTML5 movies in a popup once you hover over picture & video hyperlinks inside the doc.
Supported file extensions:
- Image: ‘jpg’, ‘jpeg’, ‘gif’, ‘png’, ‘ico’, ‘svg’, ‘bmp’
- Video: ‘mp4’, ‘webm’
Must Read: Interface to Perform A Video Player by Using the Bootstrap 5 Framework
How to make use of it:
Installation:
1. Import the image.preview.js into the document.
<script src="./dist/hover-preview.min.js"></script> // OR import hoverPreview from 'hover-preview-js';
2. Add the CSS class preview
to picture and/or video hyperlinks.
<a class="preview" href="demo.jpg">Image</a> <a class="preview" href="demo.mp4">Video</a>
3. The plugin additionally works with any container component that makes use of data-preview
attributes to specify the image/video path.
<div class="preview" data-preview="demo.jpg"> Image </div>
4. Attach the plugin to the component.
// to a single element var element = hoverPreview(document.querySelector('div.preview'),); // to multiple elements var elements = [...document.querySelectorAll('.preview')].map((element) => return hoverPreview(element); );
5. Customize the image/video preview.
var element = hoverPreview(document.querySelector('div.preview'),{ delay : 100, cursor : true });
See Demo And Download
Official Website(sixem): Click Here
This superior jQuery/javascript plugin is developed by sixem. For extra advanced usage, please go to the official website.