diff options
author | SkyArrow <tommy351@gmail.com> | 2012-01-25 06:36:17 +0100 |
---|---|---|
committer | SkyArrow <tommy351@gmail.com> | 2012-01-25 06:36:17 +0100 |
commit | 90de8379c142039bb1f9c78a78b3c8b308a24727 (patch) | |
tree | 16216a61d54b20764e2003a87d603213ddcfa606 /source | |
parent | 10ea7524170ea3d59a884e7103ac253ffbf0cf89 (diff) | |
download | octopress-theme-jeyzu-90de8379c142039bb1f9c78a78b3c8b308a24727.zip octopress-theme-jeyzu-90de8379c142039bb1f9c78a78b3c8b308a24727.tar.gz |
fix caption is undefined when alt is not defined
Diffstat (limited to 'source')
-rw-r--r-- | source/javascripts/caption.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/javascripts/caption.js b/source/javascripts/caption.js index 70614b1..8dc3856 100644 --- a/source/javascripts/caption.js +++ b/source/javascripts/caption.js @@ -4,10 +4,10 @@ $(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 { + 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+'" />'); } }); }); |