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

wont able to load the images properly after coming from server #8

Closed nitin0331 closed 10 years ago

nitin0331 commented 10 years ago

hi i m using this libraary in my mobile app and i have add the javascript and call this after ajax call inside a function

img data-src="' + IMAGE_BASE_URL + item.ThumbnailImage+ '" alt="" title="' + item.Name + '"

but it wont work images loaded as it load previously.

can u tell me the proper way how can i load images properly...

dryabov commented 10 years ago

Just call

$(window).lazyLoadXT();

right after image is added to DOM. If above way doesn't work, try

setTimeout(function() {
    $(window).lazyLoadXT();
}, 0);

PS. AJAX loading works well on demo page: http://ressio.github.io/lazy-load-xt/demo/ajax.htm

nitin0331 commented 10 years ago

hi Dryabov , i need that my images will be show as default images and once it load it replace like spinner demo so how can i do this???

dryabov commented 10 years ago

What do you mean by "default image"? If it is just a placeholder, you can either set it in blankImage option:

$.extend($.lazyLoadXT, {
  blankImage: '/path/to/default/image.png'
});

or just set it in image's src attribute:

<img src="/path/to/default/image.png" data-src="/path/to/actual/image.png" width="111" height="222">