A javascript cross-platform compatible (hopefully) photo light box plug-in for MooTools.
Syntax:
var myLightBox = new cjLightBox([options]);
Arguments:
Options:
setGalleryData(data) - To set data of the gallery. The method should be set when the box is not, and BEFORE showing.
data - (object) data - (object) Data of the gallery, structured as below:
var albumdata = { // Can be empty string. title : 'Name of the album', // Where the files are stored. pdir : 'path/to/photo/files', // List of photos in an array to be displayed. // List items can be either type of array or string. plist : [ // Array containing file name and the title of photo. ['1.jpg', 'My Dog'], // String of a file, the title will be auto replaced with the album name. '2.jpg' ] };
showPhoto([index]) - Open the box if it's not already opened, and show the specific photo.
continueView(direction) - Show the next or previous photo in the gallery.
var photoBox = new cjLightBox({ }); photoBox.setGalleryData({ title : 'My Family Album', pdir : 'photo/family', plist : [ ['1.jpg', 'Mom'], ['2.jpg', 'Dad'], 'sister.png', 'thedog.png' ] }); photoBox.showPhoto(1);
There is only ONE instance of the cjLightBox can be existing on the same page. I'm not sure if it's really neccessary to keep multiple existing, but for not, it doesn't.
Initializing the instance will also create a global variable pointing to the instance: window.__cjLightBoxInstance
The structure of photo box is shown as below:
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus