Open valnub opened 9 years ago
I am also trying to understand how to use autoInit: false
as it doesn't seem to do anything...
Try to overwrite updateEvent as well:
$.lazyLoadXT.autoInit = false;
$.lazyLoadXT.updateEvent = 'orientationchange resize scroll touchmove focus';
the same for me too. the above lines before jquery.ready doesn't have effect. images are lazy loaded.
Just had the same issue. It seems like this line:
loadEvent: 'pageshow', // check AJAX-loaded content in jQueryMobile
should have been blank by default
loadEvent: '', // check AJAX-loaded content in jQueryMobile
Seems to work after that.
I know that my answer comes a little bit late but i hope that someone will be helped. If you don't want auto init lazyload (default behaviour) you'll need to change the option to false before the document is ready. Then you'll have to init it manually using selectors.
$.extend($.lazyLoadXT, { autoInit: false });
$(document).ready(function () { $(container).find('selector').lazyLoadXT();
I can confirm kapajohns solution. In my case I'm using WordPress Sage Theme as a boilerplate and jQuery is in compatibility mode. Therefore my code was:
jQuery.extend(jQuery.lazyLoadXT, { autoInit: false, loadEvent: '' });
As you can see I also had to follow @alonsoysa solution and overwrite the load event for this to work.
This needs to be placed after lazyLoadXT is added to the dom, but before domready is fired. So if you have some sort of domready function, place it just above, for example.
In the sourcecode for lazy-load-xt I see this:
So, if options.autoinit equals false, then initLazyElements() will not be called on document.ready():
BUT it will be called on body.load event:
At this point there is no check if options.autoinit is true or false?
What's the point of that option if initLazyElement() is still triggered on body.load?