bootstrap-magnify
is a small js plugin to enhance porte-folios and image galleries.
bower install bootstrap-magnify
This plugins adds a magnifying glass to images on mouseover. This is useful in porte-folios when you want to show details of your creation but you don't have the layout space to display your 1200px wide image.
The images used are large images, shown at a smaller resolution on the website, the magnifying glass shows a small part at the native resolution. Keep in mind that large images are heavy and you must not abuse from this technique.
If you want to show the large preview at a 200% ratio, just use an image twice the size of it's container.
Import the css file in the head of your website
<link rel="stylesheet" href="bootstrap-magnify.min.css">
Or import it at the end of your bootstrap.less file
// ...
// Magnifying glass
@import "bootstrap-magnify.less"
Import the script at the bottom of your page, after jQuery.
<script src="js/bootstrap-magnify.min.js"></script>
Now, there is two way you can trigger the functionality. The easy-way, which requires zero lines of javascript is using
the data-api. Just add data-toggle="magnify"
to your image like this:
<img data-toggle="magnify" src="image.jpg" alt="">
Or, you can call it manually in javascript like this :
$('.container img').magnify();
bootstrap-magnify is released under the MIT License. See the bundled LICENSE file for details.