javascript - jQuery Lazy Load XT - Force Image Load On Custom Event -


i have custom event switchslideevent firing each time switchslide() method called jquery carousel plugin no documentation.

i using lazy load xt (https://github.com/ressio/lazy-load-xt) lazy load images, however, plugin loads images on following events load orientationchange resize scroll.

lazy load xt initialized so:

$.extend($.lazyloadxt, {    selector: 'img[data-original]',    srcattr: 'data-original',    edgey: 200,    updateevent: 'load orientationchange resize scroll switchslideevent' }); 

i've tried following solutions, haven't had success:

  1. pass switchslideevent lazy load xt updateevent option (seen above)
  2. manually re-initialize lazy load xt .on('switchslideevent') so:

i'm getting console.log events, carousel images "slid" view not loading until scroll page.

$(document).ready(function(){   $(document).on('switchslideevent', function(){     console.log("custom event fired");     $(window).lazyloadxt();   });  }); 

question

how can force lazy load xt load new images when switchslideevent fires?

any appreciated.

thanks!

within switchslide() method of carousel plugin, there animate method complete callback function. added event $.event.trigger("switchslideanimateevent") within complete callback function , adjusted initialization code follows:

$.extend($.lazyloadxt, { selector: 'img[data-original]', srcattr: 'data-original', edgey: 200, updateevent: 'load orientationchange resize scroll switchslideevent switchslideanimateevent' }); 

i removed $(document).on(switchslideevent) handler not necessary , images loading properly.

cheers.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -