diff forums/static/js/forums.js @ 643:081a88b3bfc8

Improve forum images resize script. Issue #32.
author Brian Neal <bgneal@gmail.com>
date Sun, 10 Mar 2013 12:47:21 -0500
parents ee87ea74d46b
children 99f7917702ca
line wrap: on
line diff
--- a/forums/static/js/forums.js	Sat Mar 09 18:24:46 2013 -0600
+++ b/forums/static/js/forums.js	Sun Mar 10 12:47:21 2013 -0500
@@ -288,10 +288,13 @@
 
    initAttachments();
 
-   $('div.forum-post-body img').fadeIn('fast', function() {
-         var pic = $(this);
-         if (pic.width() > 720) {
-            pic.css('width', '720px');
+   $('div.forum-post-body img').imagesLoaded(function($images, $proper, $broken) {
+      $proper.each(function(index) {
+         var $pic = $(this);
+         if ($pic.width() > 660) {
+            $pic.css('width', '660px');
+            $pic.wrap($('<a/>').attr('href', $pic.attr('src')).attr('title', 'Click to view full size'));
          }
+      });
    });
 });