javascript - Render {Caption} within {block:Photos} on Tumblr -
there seems bit of problem tumblr in can't render {caption}
tags if it's within {block:photos}
tag. problem way theme works calls done in way.
{block:photoset} <div class="object photo"> {block:photos} <a href="{photourl-highres}" class="fancybox" rel="{postid}" title="{caption}"><img src="{photourl-highres}" /></a> {/block:photos} </div> {/block:photoset}
the reason i'm using fancybox add caption each of photos in set have adding title title
attribute.
any suggestions?
the example in docs that, {caption} inside {block:photos}. in block, {caption} refers single photo's caption.
i'm guessing want photoset's caption, not single photo's. in case caption empty, you're not seeing anything.
i don't think can done via template, here's quick fix using jquery:
$('.photoset[data-caption]').each(function () {//select photosets have caption var caption = $(this).data('caption');//get stored caption $(this).find('.fancybox')//find link needs caption .attr( 'title', caption );//add caption link });
and here's template:
{block:photoset} <div class="object photoset" {block:caption}data-caption="{plaintextcaption}"{/block:caption}> <!-- note > after block caption --> {block:photos} <a href="{photourl-highres}" class="fancybox" rel="{postid}"><img src="{photourl-highres}" /></a> {/block:photos} </div> {/block:photoset}
Comments
Post a Comment