InVision jQuery Gallery plugin

Web masters often tend to make their web images look neet and fancy. For example, lightbox is today one of the most popular image plugins. However there are also numerous other gallery plugins. And by saying gallery I mean a group or a list of images. The one presented here is of my own creation and is a simplified jQuery (javascript) version of a popular Flash plugin called “photoFlow”.

Developer’s TIP:.
Skip this for later if you are here for the first time.

This plugin can also be integrated with jQuery version of lightbox.
But note this: since image dimensions are not always provided by the markup (as they should be for page speed), the gallery gets constructed as soon as all images on the site are loaded. After that, you can manipulate the images in any way you prefer (although some collision can occur so be carefull), so that also includes integrating the lightbox effect. It’s highly recommended that you use the “ready” option (as described below) to apply any additional funcionality to the images.

Also, tend to have all the images in similar dimensions for a neat look and feel of the gallery.

At one point I have also developed a simple PHP module that handles the image dimensions so they end up scaled to images of target fixed dimensions which means automatic resizing and scaling – saves a lot of trouble to Web masters and editors. I will write more about this issue in a while… However the customized way to adjust the image dimensions thru Web GUI is to use the EditImage Plugin which is described below.

Try out the sample of the gallery:

Demo: Simple Flowing Web Image Gallery


<script src="" type="text/javascript" ></script>
<script src="" type="text/javascript"></script>
<link href="" type="text/css" rel="stylesheet" />
<ul id='gallery1' class='jquery-gallery'>
		<a href='#1'><img src="/tools/samples/images/img1.jpg" alt="Desc 1" /></a>
		<p class='desc'>Walking thru the woods</p>
		<a href='#2'><img src="/tools/samples/images/img2.jpg" alt="Desc 2" /></a>
		<p class='desc'>Resting near the lake</p>
		<a href='#3'><img src="/tools/samples/images/img3.jpg" alt="Desc 3" /></a>
		<p class='desc'>A waterfall surrounded by flowers</p>
		<a href='#4'><img src="/tools/samples/images/img4.jpg" alt="Desc 4" /></a>
		<p class='desc'>Rowing a boat on the lake</p></li>
		<a href='#5'><img src="/tools/samples/images/img5.jpg" alt="Desc 5" /></a>
		<p class='desc'>The perfect vacation</p>


$(function() {
	var $gallery = $('ul#gallery1').gallery();


.jquery-gallery {
	border:1px solid black;

.jquery-gallery.loading {
	background:url('images/loader.gif') center no-repeat;

.jquery-gallery li {

.jquery-gallery a img {

.jquery-gallery p {

.jquery-gallery .current {
	border:1px solid black;

.jquery-gallery .desc {

Object methods

All of the methods are called thru the $ extension as following:


Making a button click event swing to the next image and alert the image’s ALT text:

$('#mybutton').click(function() {
	var $img = $("#mygallery").gallery("current");
	alert( $img.attr("alt") );

List of available methods

"add":function(t,src) {},

"remove":function(t,selector) {},

"focus":function(t,mixed) {},
// bring focus to an image given by selector or index

"shift":function(t,amount) {},
// Move to focus to a neighbour image which is distantiated by amount 
// (e.g. amount = 1 for the right neighbour) [USED in next,prev,swing,...]

"next":function(t) {},
// move focus to the next image

"prev":function(t) {},
// move focus to previous image

"scale":function(t,selector,scaleFactor) {},
 // rescale an image by a scaleFactor: [ USED INTERNALLY : TODO: REMOVE FROM HERE]

"swing":function(t) {},
// Move to next image in current swing direction, if currently on the end, switch direction and then next

"swingcontinue":function(t) {},
// continue swinging [ USED INTERNALY : RECURSIVE! ]

"swingstart":function(t) {},
// Force start swinging

"swingstop":function(t) {},
// Force stop swinging

"current":function(t) {}
// return current focused image as in $(img)


Options and defaults

var defaults = {

ready:function() {},
// This function will be ran in the provided DOM element's context when the Gallery is constructed
// I encourage you tu use this when implementing InVision Gallery along with jQuery version of Lightbox

// when set to true, the images are pre-loaded (they get the loading priority) 

// when set to true, the structurea and images are used from existing DOM [ RECOMENDED ]

// list of images, when need to construct the DOM [ NOT IMPLEMENTED YET ]

// default animation duration

// by distance from center this factor is used

// by distance from center this factor is used for opacity

// default effect is photoFlow [ NOT IMPLEMENTED YET ]

// the inital distance between two neighbour images (focused image to it's left / right sibling)

// as getting further from focused image, 
// the images get distantiated by imageDistance * distinaceFactor ^ distance

// max height of an image [ EXPERIMENTAL | NOT IMPLEMENTED YET ]

// since using absolute positioning, a container with no CSS defined dimensions 
// will "loose" it's height, this should remain as is, and you should provide dimensions [ EXPERIMENTAL ]

// The class or selector which determines an element which holds the image description [ TEMPORARY ] 
// Usually that element is found by following query: $img.parent().parent().find(descriptionSelector)

// when set to true: images will scroll with the mouse wheel
// wheter to start swinging the gallery on startup

// How much delay in miliseconds between switching focus to a neighbour image


DOM Extensions

In order to reference the DOM more quickly and to determine if a gallery has been constructed, some extensions are being added to DOM objects. This is provided here for debugging purposes and namespace hazards. I’m aware that there should be as least as possible of these, but note that this is still a BETA version.

// the gallery main object is attachted to the container for quick referencing

// reference to a function which should be ran when Gallery has been constructed, 
// this is constructed and deleted after first execution

// the image's zero-based index in it's main container object

// reference to the corresponding image description element


InVision Jquery Gallery [BETA] plugin requires following (versions last updated in 2010 at least):


Source Code

Source code:
InVision jQuery Gallery on GitHub

Clone from GitHub:

git clone


Direct Download Link:
Download InVision jQuery Gallery from GitHub

Version information

Current Version: BETA 1.0
Last update: 10th August 2010


Currently tested on Windows XP, and WIn 7 among following browsers:
– Mozilla Firefox 3.6+
– Google Chrome 5.0+
– Internet Explorer 8+
TIP: Most of potential discompatibility can be avoided thru CSS editing.


If you’ve used this plugin and like it, be so kind to buy me a coffee! :-)

Donation points

Web Plugins | Posted on July 2, 2013 by .

About Kristijan Burnik

Kristijan Burnik is a Programmer and Web Developer specializing in Server-side and Client-side Technologies and Application Development on Linux Servers and Windows Desktop . Also has experience in Networking, Desktop application development as well as Android mobile application development . Experienced in Programming Languages like Java, C, C++, C#, PHP, Javascript, MySQL and somewhat in other languages like Bash, Perl & Python. Sometimes he works as a Graphical Designer for digital production as well as for printing and advertising. He dedicates his spare time writing Tech Articles on his blog in order to share his work with others, as well as to document his projects for his own use. He's also an Educator & Mentor in field of Algorithms and Programming to young programmers in Zagreb, Croatia.

Leave a Reply