Mosne's Swipebox.

A touchable jQuery lightbox
a fork from brutaldesign.

What is Swipebox ?

Swipebox is a jQuery "lightbox" plugin for desktop, mobile and tablet.

Main Features

  1. Swipe gestures for mobile
  2. Keyboard Navigation for desktop
  3. CSS transitions with jQuery fallback
  4. Retina support for UI icons
  5. Easy CSS customization


Chrome, Safari, Firefox, Opera, IE8+, IOS4+, Android, windows phone.

Try it

Basic Usage


Include jquery and the swipebox script in your head tags or right before your body closing tag.

<script src="lib/jquery-2.0.3.js"></script>
<script src="source/jquery.swipebox.js"></script>


Include the swipebox CSS style in your head tags.

<link rel="stylesheet" href="source/swipebox.css">


Use a specific class for your links and use the title attribute as caption.

<a href="big/image.jpg" class="swipebox" title="My Caption">
	<img src="small/image.jpg" alt="image">

Fire the plugin

Bind the swipebox behaviour on every link with the "swipebox" class.

<script type="text/javascript">
jQuery(function($) {


Use "rel" Attribute

You can add a rel attribute to your links to seperate galleries.

<!-- Gallery 1 -->
<a rel="gallery-1" href="big/image1.jpg" class="swipebox">
	<img src="small/image1.jpg" alt="image">
<a rel="gallery-1" href="big/image2.jpg" class="swipebox">
	<img src="small/image2.jpg" alt="image">
<!-- Gallery 2 -->
<a rel="gallery-2" href="big/image3.jpg" class="swipebox">
	<img src="small/image3.jpg" alt="image">
<a rel="gallery-2" href="big/image4.jpg" class="swipebox">
	<img src="small/image4.jpg" alt="image">

Video support

Simply paste a youtube video URL in your href attribute. The script will automatically check if it's a Youtube URL and open the video in the swipebox.

YouTube demo

Vimeo demo

Dailymotion demo

<a class="swipebox-video" rel="youtube" href="">My Videos</a>

Load slides dynamically

You can set your gallery dynamically by passing an array object to the swipebox.

View gallery

		{href:'big/image1.jpg', title:'My Caption'},
		{href:'big/image2.jpg', title:'My Second Caption'}

Refresh Method

The refresh method allows you to reload the slides if the DOM has changed.

var swipeboxInstance = $(".a:visible").swipebox();

// Use the refresh method after your event is completed

For exemple, if you use isotope filter.

// Use the swipebox only for  visible elements
var swipeboxInstance = $(".swipebox-isotope:not(.isotope-hidden .swipebox-isotope)").swipebox();

// Callback function that fire the refresh method, once the animation is finished
onAnimationCompleted = function(){

// Isotope stuff
optionFilterLinks = $('#filter').find('a');
optionFilterLinks.attr('href', '#'); function(){
	var selector = $(this).attr('data-filter');
		filter : '.' + selector,
		itemSelector : '.item',
		layoutMode : 'fitRows',
		animationEngine : 'best-available',
	}, onAnimationCompleted); // callback here


	return false;

Check open state

if ($.swipebox.isOpen){
	// do stuff


<script type="text/javascript">
jQuery(function($) {
		useCSS : true, // false will force the use of jQuery for animations
		hideBarsDelay : 3000, // 0 to always show caption and action bar
		videoMaxWidth : 1140, // videos max width
		beforeOpen: function(){}, // called before opening
	      	afterClose: function(){} // called after closing

View Source

plugin javascript

plugin css

plugin images


Forked from brutaldesign

Photos by Daniele Zedda