Dopracowanie leniwego doładowywania stron (problemy są w momencie, kiedy skan strony...
authorzuber <marek@stepniowski.com>
Mon, 17 Aug 2009 22:09:45 +0000 (00:09 +0200)
committerzuber <marek@stepniowski.com>
Mon, 17 Aug 2009 22:09:45 +0000 (00:09 +0200)
project/static/js/jquery.lazyload.js
project/templates/explorer/folder_images.html

index 25c9486..ea3de6f 100644 (file)
                         || belowViewport(container, this, settings.threshold)) {
                         $(this).html(settings.placeholder);
                     } else {
-                        $(this).html('<img src="' + $(this).attr('src') + '" width="' + $(this).width() + '" />');
+                        $(this).html('');
+                        var self = this;
+                        $('<img src="' + $(this).attr('src') + '" width="' + $(this).width() + '" />').load(function() {
+                            if ($(this).height() > $(self).height()) {
+                                $(self).height($(this).height());
+                            }
+                        }).appendTo(this);
                     }
                 })
             }
index e6beb07..4104926 100644 (file)
@@ -1,5 +1,5 @@
 {% for image in images %}
-    <div class="image-box" src="{{ image }}" style="width: 460px; height: 460px; margin: 5px; background-color: gray">
+    <div class="image-box" src="{{ image }}" style="width: 480px; height: 640px; border:1px solid #DDD; margin: 5px">
         <p>{{ image }}</p>
     </div>
 {% endfor %}
\ No newline at end of file