Skip to content

Instantly share code, notes, and snippets.

@addisonhall
Created July 16, 2014 14:00
Show Gist options
  • Save addisonhall/05c2c4301cc35683fa1b to your computer and use it in GitHub Desktop.
Save addisonhall/05c2c4301cc35683fa1b to your computer and use it in GitHub Desktop.
Convert BC photo galleries into Fancybox lists
// Convert BC photo galleries to lists
var $pg = $('.photogalleryTable');
if ($pg.length) {
$pg.each(function(index){
var $pgInner = $(this).html();
$(this).replaceWith('<ul id="gallery-'+index+'" class="list-inline list-gallery product-gallery">' + $pgInner + '</ul>');
var $newGallery = $('#gallery-'+index);
$newGallery.find('a').addClass('fancybox').removeAttr('onclick').attr('rel', 'group-'+index).wrap('<li>').find('img').addClass('img-responsive');
$newGallery.css('visibility', 'visible').hide().fadeIn();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment