diff options
Diffstat (limited to 'source/javascripts')
-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+'" />'); } }); }); |