summaryrefslogtreecommitdiffstats
path: root/source/javascripts/caption.js
blob: 70614b1ecfd8faaf29541b414e3f2f7f91675571 (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 != ''){
				$(this).after('<span class="caption">'+alt+'</span>').wrap('<a href="'+$(this).attr('src')+'" class="fancybox" title="'+alt+'" rel="gallery'+_i+'" />');
			} else {
				$(this).wrap('<a href="'+$(this).attr('src')+'" class="fancybox" rel="gallery'+_i+'" />');
			}
		});
	});
	$('.fancybox').fancybox();
})(jQuery);