Files
interblue.pl/modules/stlazyloading/views/js/stlazyloading.js
2024-10-25 14:16:28 +02:00

26 lines
819 B
JavaScript

$(document).ready(function() {
prestashop.stlazyloading = function(images) {
images.each(function(){
$(this).waypoint(function () {
var $element = $(this.element);
this.destroy();
$element.on('load', function () {
$(this).parent().removeClass('is_stlazyloading');
$(this).removeClass('stlazyloadthis');
Waypoint.refreshAll();
});
$element.attr('src', $element.data('src'));
},{offset: '100%'});
});
};
prestashop.on('updateProductList', function(data) {
var images = $('img.stlazyloadthis');
if(images.size())
prestashop.stlazyloading(images);
});
var images = $('img.stlazyloadthis');
if(images.size())
prestashop.stlazyloading(images);
});