- Overview
- Documents
- Demos
Scalable Lightbox is a jQuery plugin for building aesthetically minimalistic, responsive picture lightboxes. Features an index module for providing an overview with thumbnails as well as a lightbox module, for displaying high-res images in a responsive manner.
Features
- Retina ready
- Responsive and touch optimized
- Hardware accelerated CSS3 animations
- Simple integration
- Integrated image preloader
- Highly optimized code
- Comprehensive documentation
- Multiple demos
-
sex shop
sex shop
sex shop
sex shop
sex shop
seks shop
spanish fly
psikolog
sohbet numara
sohbet hatti
Source: scalable-lightbox.com
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" href="css/jquery.scalable-lightbox.css" /> <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="js/jquery.scalable-lightbox.js"></script>
2. HTML
<div id="projects-container" class="clearfix"> <a class="project-item" href="#1"> <div class="img"> <img src="https://www.scalable-lightbox.com/assets/img/thumbs/canyon-house.jpg" /> </div> <div class="caption"> <h3>Canyon House</h3> </div> </a> <a class="project-item" href="#2"> <div class="img"> <img src="https://www.scalable-lightbox.com/assets/img/thumbs/italpromo.jpg" /> </div> <div class="caption"> <h3>Italpromo</h3> </div> </a> </div>
3. JAVASCRIPT
$(function() { // initialize ScalableLightbox $.ScalableLightbox({ // show what's happening in // the debugger console debug: true, // define the path for all // resources (images): baseImgPath: 'https://www.scalable-lightbox.com/assets/img/lightbox/', // define data structure inline data: [ // canyon house (deck id 1) { "id": 1, "items": [ { "img": "canyon-house/01.jpg", "width": 1500, "height": 2173, "caption": "Canyon House 01.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" }, { "img": "canyon-house/04.jpg", "width": 1500, "height": 1033, "caption": "Canyon House 04.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" }, { "img": "canyon-house/03.jpg", "width": 1500, "height": 2173, "caption": "Canyon House 03.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" } // additional item objects ... ] }, // italpromo (deck id 2) { "id": 2, "items": [ { "img": "italpromo/01.jpg", "width": 1500, "height": 2173, "caption": "Italpromo 01.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" }, { "img": "italpromo/04.jpg", "width": 1500, "height": 751, "caption": "Italpromo 04.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" }, { "img": "italpromo/05.jpg", "width": 1500, "height": 1033, "caption": "Italpromo 05.jpg by <a href=\"http://www.labics.it\" target=\"_blank\">Labics</a>" } // additional item objects ... ] } ], // set index layout to masonry index: { layout: "masonry" } }); // define click behavior by employing // the open method $(".project-item").click(function(e) { // get the deck id of the current item var id = parseInt($(this).attr("href").substring(1), 10); // prevent the default anchor behavior e.preventDefault(); // open the lightbox module $.ScalableLightbox("open", { module: "lightbox", deck: id }); }); });
4. OPTIONS
The options object has the following structure:
$.ScalableLightbox({ // data settings data: [], api: null, // general settings debug: false, resize: "smartresize", hash: true, baseImgPath: "", // index module settings index: { // ... }, // lightbox module settings lightbox: { // ... }, // callback settings callbacks: { // ... }, // class name settings classNames: { // ... }, // transition settings transitions: { // ... } });
5. METHODS
open
The open method is used to either open the thumbnails of a provided deck in the index moduleor to display a lightbox of a specific deck in the lightbox module.
Via the opts object of this method, you can define, which module should be opened (either"index" or "lightbox"), provide the id of the deck and in case of the lightbox module, which image should be displayed via the index attribute (index counting starts at 0).
Therefore to open the deck with id 15 and display the third image, you put the following:
In case you want to invoke a callback on every open call, you should define a general open callback in the callback settings. If a nonrecurring callback is provided along with the method above, the general open callback is not executed.
close
Closes the currently opened (displayed) lightbox or index module. The method features a nonrecurring callback, that gets triggered once the closing has finished.
In case you want to invoke a callback on every close call, you should define a general close callback in the callback settings. If a nonrecurring callback is provided along with the method above, the general close callback is not executed.
destroy
To destroy all the markup the Plugin has created and remove all event bindings of the Plugin. A nonrecurring callback may be employed, that is invoked after the destruction.
prev
This is only working, if the lightbox module is enabled and a lightbox is currently opened. It willnavigate the lightbox from the current image to the previous one in the deck. If it is the first image, it will automatically start from the end again (endless carousel).
This method is also used internally in case a user clicks on the left side of the lightbox container (see clicks controls for deactivation) as well as the left keyboard arrow (see keys controls for deactivation).
next
This is only working, if the lightbox module is enabled and a lightbox is currently opened. It willnavigate the lightbox from the current image to the next one in the deck. If it is the last image, it will automatically start from the beginning again (endless carousel).
This method is also used internally in case a user clicks on the right side of the lightbox container (see clicks controls for deactivation) as well as the right keyboard arrow (see keys controls for deactivation).
goto
This is only working, if the lightbox module is enabled and a lightbox is currently opened. It willnavigate the lightbox from the current image to the i-th one in the deck.
This method is also used internally by the Plugin to navigate from a thumbnail of the index module to the corresponding image in the lightbox module, once the user has clicked on the thumbnail.
resize
This method is used to manually resize the Plugin. Whether the index or lightbox module is resized, depends on what is currently active. The method features a nonrecurring callback, that gets triggered once the resizing of the Plugin has finished. In case the plugin is not active, meaning it is not displayed to the user, nothing (not even the callback) will be executed.
In case you want to invoke a callback on every resize call, you should define a general resize callback in the callback settings. If a nonrecurring callback is provided along with the method above, the general resize callback is not executed.
$.ScalableLightbox("open", opts, function() {
// nonrecurring callback when opening has finished
});
// lightbox module
// open deck 2 (displaying first image, index: 0 by default)
opts = { module: "lightbox", deck: 2 };
// open deck 10 and display second image (index starts at 0)
opts = { module: "lightbox", deck: 10, index: 1 };
// index module
opts = { module: "index", deck: 2 };
$.ScalableLightbox("open", { module: "lightbox", deck: 15, index: 2 }, function() {
// nonrecurring callback when opening has finished
});
$.ScalableLightbox("close", function() {
// nonrecurring callback when closing has finished
});
$.ScalableLightbox("destroy", function() {
// nonrecurring callback when destruction has finished
});
$.ScalableLightbox("prev");
$.ScalableLightbox("next");
Counting starts at 0. If the provided index is lower than 0 or higher then the total number of items in the current deck, it will display the last image of the current deck.
$.ScalableLightbox("goto", index);
// go to 10th image of the current deck
$.ScalableLightbox("goto", 9);
// go to first image of the current deck
$.ScalableLightbox("goto", 0);
// go to last image of the current deck
// by providing a number below zero or
// higher then the total number of items
// in the current deck
$.ScalableLightbox("goto", -1);
$.ScalableLightbox("goto", 1000);
$.ScalableLightbox("resize", function() {
// nonrecurring callback when plugin resize has finished
});
Usually you do not need to invoke this method, because resizing is done automatically by the Plugin. However you might want to deactivate auto-resizing by setting the resize option tofalse and then do the resizing within your own code.
$.ScalableLightbox({
resize: false
});
$(window).bind("resize", function() {
// do my resize stuff
// ...
$.ScalableLightbox("resize");
// ...
});