yBox is a lightweight and feature-rich lightbox JavaScript library for images, videos, iframes, text, and any HTML content out of the box.
Compatibility
Modern browsers such as Chrome, Firefox, and Safari have been tested on both desktop and smartphone devices.
Must Read: Modern Photo/Video Gallery and Lightbox Plugin | nanogallery2
How to make use of it:
1. Start by inserting the yBox’s JavaScript and CSS into the HTML document.
<link rel="stylesheet" href="dist/css/yBox.min.css" /> <script src="dist/js/yBox.min.js"></script>
2. Initialize the yBox library.
window.onload = function(){ if(document.querySelector('.yBox')){ var myYbox = new yBox(); myYbox.init(); }; }
3. Show a lightbox when needed.
myYbox.yBox('Lightbox Content Here');
4. Load content from any component throughout the document.
<div style="display:none;"> <div id="modalContent"> Modal Content here </div> </div>
<a class="yBox" href="#modalContent">Launch The Lightbox</a>
5. Open an iframe within the lightbox. Ideal for Youtube videos.
<a href="https://www.youtube.com/watch?v=1" class="yBox yBox_iframe"> Open The Youtube Video </a>
6. Load content through AJAX.
<a href="https://www.google.com" class="yBox yBox_ajax"> Launch The Lightbox </a>
7. Apply a further CSS class to the lightbox.
<a class="yBox" data-popup-class="customClass" href="#modalContent">Launch The Lightbox</a>
8. Create a gallery lightbox from a bunch of photos.
<a href="1.jpg" class="yBox" data-ybox-group="group1"> // Add Image Here </a> <a href="2.jpg" class="yBox" data-ybox-group="group1"> // Add Image Here </a> <a href="3.jpg" class="yBox" data-ybox-group="group1"> // Add Image Here </a> ...
9. Event handlers.
myYbox.onYboxOpen = function(){ // Fired when yBox is opened }; myYbox.onYboxClose = function(){ // fired when yBox is closed }; myYbox.onNextItemClick = function(){ // fired when clicking next button }; myYbox.onPrevItemClick = function(){ // fired when clicking prev button };
See Demo And Download
Official Website(Leshemiko): Click Here
This superior jQuery/javascript plugin is developed by Leshemiko. For extra advanced usage, please go to the official website.