Difference between revisions of "Image slider"
From Organic Design wiki
m |
m |
||
Line 41: | Line 41: | ||
var next = '<a class="is-next" href="javascript:">next ></a>'; | var next = '<a class="is-next" href="javascript:">next ></a>'; | ||
div.html( '<table><tr><th><table><tr><td>' + prev + next + '</td></tr></table></th></tr></table>' ); | div.html( '<table><tr><th><table><tr><td>' + prev + next + '</td></tr></table></th></tr></table>' ); | ||
− | $('.is-prev', div).click(function() { slide($('div').has(this), -1 ); }); | + | $('.is-prev', div).click(function() { slide($('div.image-slider').has(this), -1 ); }); |
− | $('.is-next', div).click(function() { slide($('div').has(this), 1 ); }); | + | $('.is-next', div).click(function() { slide($('div.image-slider').has(this), 1 ); }); |
// Set the cell size to the image size and other css styles | // Set the cell size to the image size and other css styles |
Revision as of 00:00, 31 March 2015
Here's a simple image slider written 100% in JavaScript and jQuery. In converts any div elements of class "image-slider" containing img elements in a slider like the one below.
The code is in our Subversion repository here.