Usunięcie marginesów wokół obrazków w galerii skanów.
[redakcja.git] / project / static / js / jquery.lazyload.js
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);
                     }
                 })
             }