Slimbox2

Component ID

2102751

Component name

Slimbox2

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

996

Component created

Component changed

Component body

The Drupal Slimbox2 module is a wrapper that integrates the lightweight Slimbox2 jQuery plugin with a Drupal site seamlessly and automatically. Once installed and activated, you can add lightbox effects to hyperlinks by adding a rel="lightbox" or rel="lightbox-series" attribute to your link.

Why another lightbox plugin?
Good question. With the availability of Colorbox, Lightbox2 and Fancybox, why would there be interest in another image lightbox utility?

The answer is simplicity... I wanted a simple plugin that I could install and just start using. I don't need multiple styles of lightboxes, I just want a module with a tiny code footprint that will let me easily create links to images with a lightbox effect. As a bonus, the Slimbox2 jQuery plugin is also a very small piece of code when compared with the other plugins. It's about 4k which is less than half the size of the others, so it's a win-win.

About the Slimbox2 jQuery plugin (from the Slimbox2 web page)
Slimbox2 is a 4 KB visual clone of the popular Lightbox2 script by Lokesh Dhakar, written using the jQuery javascript library. It was designed to be very small, efficient, standards-friendly, fully customizable, more convenient and 100% compatible with the original Lightbox2.

More information about the Slimbox2 plugin can be found here: http://www.digitalia.be/software/slimbox2

Dependencies:

Note: The D8 branch (under development) does not require the Libraries API module.

Installation Drush (Recommended):

  1. Install the Libraries API module: drush en libraries -y
  2. Install this Slimbox2 module: drush en slimbox2 -y
  3. Upload the Slimbox2 plugin to /site/all/libraries: drush slimbox2-plugin

Installation Manually:

  1. Get the Slimbox 2 plugin from

    https://github.com/cbeyls/slimbox/releases/tag/2.05
  2. unpack the Slimbox 2 plugin and rename to slimbox2
  3. Upload the slimbox2 plugin to your Drupal site's libraries folder.

    Usually found at: /sites/all/libraries/

    Full path with slimbox2: /sites/all/libraries/slimbox2
  4. Install the Libraries API module

    https://drupal.org/project/libraries
  5. Install this Slimbox2 module

    https://drupal.org/project/slimbox2
  6. Activate Libraries and Slimbox2

D8
Currently the DEV branch is the only version for Drupal 8.

The Drupal Core Team been debating about what to do with 3rd party libraries so for the moment I haven't built the drush mechanism for installing the Slimbox2 jQuery plugin.

The discussion appears to be looking towards placing 3rd party libraries in a "libraries" directory in the root of the site. So that's what we're doing too. In order to add the 3rd party Slimbox2 library in Drupal 8, you'll want to add a libraries directory to our root directory and then place the Slimbox2 jQuery plugin. So the resulting path will look like this:
/libraries/slimbox2

Read the README.txt file for more details.

Usage
Create a hyperlink to the image that you want to see in a lightbox and add a rel="lightbox" attribute to your link. For example once the slimbox2 module is installed, if you have an image at /sites/default/files/images/big-image.jpg, you could link to it with a "lightbox" effect with the following HTML markup.

<a href="/sites/default/files/images/big-image.jpg" rel="lightbox">lightbox link</a>

For lightbox series adjust the links as follows: (rel="lightbox-series")

<a href="/sites/default/files/images/big-image1.jpg" rel="lightbox-series">lightbox link</a>
<a href="/sites/default/files/images/big-image2.jpg" rel="lightbox-series">lightbox link</a>
<a href="/sites/default/files/images/big-image3.jpg" rel="lightbox-series">lightbox link</a>
<a href="/sites/default/files/images/big-image4.jpg" rel="lightbox-series">lightbox link</a>

<!-- The rel="lightbox-series" could be anything as long as it prefixed with "lightbox-"  -->

* See the README.txt file for more information.

Disclaimer
I don't know the author of the Slimbox2 jQuery plugin and have only developed this module because I have found it simple to use. I hope others find this module useful and easy to use.

Note: The Slimbox2 module is an efficient, lightweight solution to adding lightbox links, lightbox image series and lightbox galleries to a Drupal site but where it shines in simplicity, it is limited to a single lightbox style and only applies the lightbox effect to images at this time. For a more feature oriented module, with options to applying lightbox effects to nodes and other media, I would suggest looking at the Colorbox module and its related modules.