Created
December 5, 2013 10:42
-
-
Save vdchristelle/7803350 to your computer and use it in GitHub Desktop.
colorbox gallery
Overview page with teasers: we want every teaser to be a gallery of its own and not all images off all teasers in 1 colorbox
solution: add specific class per gallery on the a elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// references | |
// loop through teasers | |
// add different rel to each li | |
// for colorbox to see each teaser as a separate gallery | |
var count = 0; | |
$('ul.references.overview li').each(function(){ | |
$(this).find('.colorbox a').attr('rel','gallery-'+count); | |
// add class to first list item, to be able to hide all others | |
$(this).find('ul li:first').addClass('show'); | |
count++; | |
}); | |
// COLORBOX | |
$(".colorbox a").colorbox({ | |
// rel:'gal', //uncomment if you want all teaser images to appear in the same colorbox gallery | |
transition:'fade', | |
maxWidth:'100%', | |
maxHeight:'100%', | |
title:function(){ | |
return $(this).find("img").attr('alt'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment