diff --git a/input/assets/js/main.js b/input/assets/js/main.js
index b5ad4c196..30f6755ae 100755
--- a/input/assets/js/main.js
+++ b/input/assets/js/main.js
@@ -205,31 +205,32 @@ $("ul#bzoom").each(function(index, ul) {
});
});
-
// Lazy loading for images
-var loadImage = function(self, imgSource) {
- self.hide();
- if (self.is("img")) {
- self.attr("src", imgSource);
- } else {
- self.css("background-image", "url('" + imgSource + "')");
- }
- self.fadeIn("slow");
- return self.removeClass("img-lazy").removeAttr("data-original");
-};
-
-var placeholder = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
-$(".img-lazy").each(function() {
- var self = $(this);
- if (self.parent().is(":visible")) {
+$(function() {
+ var loadImage = function(self, imgSource) {
+ self.hide();
if (self.is("img")) {
- self.attr("src", placeholder);
+ self.attr("src", imgSource);
+ } else {
+ self.css("background-image", "url('" + imgSource + "')");
}
- var imgSource = self.data("original");
- return $("").bind("load", function() {
- return loadImage(self, imgSource);
- }).attr("src", imgSource);
- }
+ self.fadeIn("slow");
+ return self.removeClass("img-lazy").removeAttr("data-original");
+ };
+
+ var placeholder = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+ $(".img-lazy").each(function() {
+ var self = $(this);
+ if (self.parent().is(":visible")) {
+ if (self.is("img")) {
+ self.attr("src", placeholder);
+ }
+ var imgSource = self.data("original");
+ return $("").bind("load", function() {
+ return loadImage(self, imgSource);
+ }).attr("src", imgSource);
+ }
+ });
});