Reputation: 529
I would like to modify javascript trigger 'ready' and 'ajaxStop' for Lazy Load plugin
$(document).ready(function() {
$("img.lazy").lazyload({
threshold:50,
skip_invisible : false,
effect: "fadeIn"
}).removeClass("lazy");
});
$(document).ajaxStop(function() {
$("img.lazy").lazyload({
threshold:50,
skip_invisible : false,
effect: "fadeIn"
}).removeClass("lazy");
});
It should be something like this:
$(document).any-possible-function(function() {
...
});
To minimize the code, Please help with modification.
Upvotes: 1
Views: 758
Reputation: 6771
Not sure what do you want to achieve but to minimize your code write it like this:
var lazyLoader = function() {
$("img.lazy").lazyload({
threshold:50,
skip_invisible : false,
effect: "fadeIn"
}).removeClass("lazy");
};
$(document)
.ready(lazyLoader)
.ajaxStop(lazyLoader);
Upvotes: 2