ressio / lazy-load-xt

Lazy load XT is a jQuery plugin for images, videos and other media
http://ress.io/lazy-load-xt-jquery/
MIT License
1.36k stars 245 forks source link

Listen for changes? #57

Closed Daijobou closed 8 years ago

Daijobou commented 8 years ago

I use attribute "data-bg" (jquery.lazyloadxt.bg.js) and its working fine. Now I must via click() change all backgroud-images to another folder. Easy with

$(...).removeAttr('style').attr('data-bg', url);

images get removed, but LazyLoadXT not refresh for new images (only images that was not in viewport and not updated with lazy before). I have tried call $(document).lazyLoadXT(); but thats not help me. Any idea?

This works only for images in viewport, all other images get lost:

$(window).lazyLoadXT({
    checkDuplicates: false
});

SOLUTION:

$(....).data('lazied', 0).removeAttr('style').attr('data-bg', url);