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

23 lines
751 B
JavaScript

var 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%'});
});
};
var stlazyloading_mater = function(){
var images = $('img.stlazyloadthis');
if(images.size())
stlazyloading(images);
}
$(document).ready(function() {
stlazyloading_mater();
$(document).on('click', '#grid,#list', function(e){stlazyloading_mater();});
});