Skip to content

Instantly share code, notes, and snippets.

@ara303
Last active January 4, 2016 15:19
Show Gist options
  • Save ara303/8639749 to your computer and use it in GitHub Desktop.
Save ara303/8639749 to your computer and use it in GitHub Desktop.
My config for StyleHatch's jQuery plugin for Tumblr Photosets
{block:Photoset}
<div class="media{block:Caption} has-caption{/block:Caption}">
<div class="photoset-grid" data-layout="{PhotosetLayout}" style="visibility: hidden;">
{block:Photos}
<img src="{PhotoURL-500}" {block:HighRes}data-highres="{PhotoURL-HighRes}"{/block:HighRes} data-width="{PhotoWidth-HighRes}" data-height="{PhotoHeight-HighRes}" {block:Caption}alt="{Caption}"{/block:caption} />
{/block:Photos}
</div>
</div>
{block:Caption}
<div class="inner">
<div class="body">
{Caption}
</div>
</div>
{/block:Caption}
{/block:Photoset}
$('.photoset-grid').photosetGrid({
gutter: '10px',
rel: 'photoset-item',
onComplete: function(){
$('.photoset-grid').attr('style','');
}
});
$('.photoset-grid').each(function(){
var photosetImages = $(this).find('img');
var photosetPackage = [];
for(i = 0; i < photosetImages.length; i++) {
photosetImages.eq(i).attr('data-count',i+1);
}
$(this).find('img').each(function(){
var packagePart = {
width: $(this).data('width'),
height: $(this).data('height'),
low_res: $(this).attr('src'),
high_res: $(this).data('highres')
};
photosetPackage.push(packagePart);
$(this).on('click',function(){
Tumblr.Lightbox.init(photosetPackage,$(this).data('count'));
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment