- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
JS Animated. How to implement jQuery “Magnific Popup” lightbox plugin
January 21, 2014
This tutorial is going to show you how to implement the jQuery Magnific Popup lightbox plugin into your JS Animated template.
JS Animated. How to implement jQuery “Magnific Popup” lightbox pluginMagnific Popup is a fast, light, mobile-friendly and responsive lightbox and modal dialog plugin built using the jQuery library. To see it in action, you can play with examples on CodePen. To add it to your page:
Download Magnific-Popup-master.zip from https://github.com/dimsemenov/Magnific-Popup on your computer and unpack it.
Copy the dist folder from the unzipped package and paste into the site folder of your template package.
- Open the .html file with the image you want to apply the plugin to and add the libraries and the table of styles to it in DreamWeaver inside of the <head> tag:
<!-- Magnific Popup core CSS file --> <link rel="stylesheet" href="./dist/magnific-popup.css"> <!-- Magnific Popup core CSS file --> <link rel="stylesheet" href="./dist/magnific-popup.css"> <!-- Magnific Popup core JS file --> <script src="./dist/jquery.magnific-popup.js"></script>
- Find the line with the image e.g.
- And change it to
- In the images folder there should be image_big.jpg and image_small.jpg accordingly.
- To initialize the popup, add the following to your .html file right before the closing </head> tag or in the footer of your site (before the closing </body> tag:
- Save the changes and check your page in a web browser: the image should be opening in a lightbox with a title. Your site should be up and running on a remote/local server to see the plugin in action.
<img src="images/image_small.jpg" alt="" />
<a class="image-popup-vertical-fit" href="images/image_big.jpg" title="Title"> <img src="images/image_small.jpg"> </a>


<script> $(document).ready(function() { $('.image-popup-vertical-fit').magnificPopup({ type: 'image', closeOnContentClick: true, mainClass: 'mfp-img-mobile', image: { verticalFit: true } }); }); </script>


For more information on how to use the plugin, please refer to the official manual at: http://dimsemenov.com/plugins/magnific-popup/documentation.html#initializing_popup
Feel free to check the detailed video tutorial below:
JS Animated. How to implement jQuery “Magnific Popup” lightbox plugin