diff options
author | SkyArrow <tommy351@gmail.com> | 2012-01-24 18:18:01 +0100 |
---|---|---|
committer | SkyArrow <tommy351@gmail.com> | 2012-01-24 18:18:01 +0100 |
commit | 84695ac13a34ade6a7752b127ff93ca8a3ffddf9 (patch) | |
tree | 5fcf35dde29ca22307998e212e454450cd1db076 /source/javascripts/caption.js | |
parent | a9a4bf51f0597ec616fa7e3345ac6f4203f0a273 (diff) | |
download | octopress-theme-jeyzu-84695ac13a34ade6a7752b127ff93ca8a3ffddf9.zip octopress-theme-jeyzu-84695ac13a34ade6a7752b127ff93ca8a3ffddf9.tar.gz |
include fancybox
Diffstat (limited to 'source/javascripts/caption.js')
-rw-r--r-- | source/javascripts/caption.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/javascripts/caption.js b/source/javascripts/caption.js index 271c428..70614b1 100644 --- a/source/javascripts/caption.js +++ b/source/javascripts/caption.js @@ -1,9 +1,15 @@ (function($){ - $('.entry img').each(function(){ - var alt = $(this).attr('alt'); + $('.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>'); - } + 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);
\ No newline at end of file |