Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-23 14:28:33

keoshi
Member
From: Portugal
Registered: 2006-04-30
Posts: 53

Dynamic implementation of fancybox (lightbox variant)

Hey guys,

I’m trying to output a gallery from TXP using lightbox/fancybox.
Each article has an article_image associated.

So, to call fancybox as a gallery I have to use a rel tag:
a rel="gallery"
and
$("a[rel=gallery]").fancybox({

I’d like to output category names/IDs as the rel tag, but how would I inject that on the JS for each category?

Thanks in advance,
F

Offline

#2 2010-12-23 14:35:26

keoshi
Member
From: Portugal
Registered: 2006-04-30
Posts: 53

Re: Dynamic implementation of fancybox (lightbox variant)

I got it:

<script type="text/javascript">
<txp:category_list wraptag="" break="">
<txp:article_custom category='<txp:category />' limit="1" break="">
$(document).ready(function() {
	$("a[rel=<txp:category />]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
</txp:article_custom>
</txp:category_list>
</script>

Last edited by keoshi (2010-12-23 17:06:03)

Offline

Board footer

Powered by FluxBB