summaryrefslogtreecommitdiffstats
path: root/source/javascripts/caption.js
blob: 8dc38568832d1ad84450b42424ec5cb097ac3620 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(function($){
	$('.entry').each(function(i){
		var _i = i;
		$(this).find('img').each(function(){
			var alt = $(this).attr('alt');

			if (alt == '' || typeof alt == 'undefined'){
				$(this).wrap('<a href="'+$(this).attr('src')+'" class="fancybox" rel="gallery'+_i+'" />');
			} else {
				$(this).after('<span class="caption">'+alt+'</span>').wrap('<a href="'+$(this).attr('src')+'" class="fancybox" title="'+alt+'" rel="gallery'+_i+'" />');
			}
		});
	});
	$('.fancybox').fancybox();
})(jQuery);