question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option autoInit = false seems to have no effect?

See original GitHub issue

In the sourcecode for lazy-load-xt I see this:

    $(document).ready(function () {
        triggerEvent('start', $window);

        $window
            .on(options.loadEvent, initLazyElements)
            .on(options.updateEvent, queueCheckLazyElements)
            .on(options.forceEvent, forceLoadAll);

        $(document).on(options.updateEvent, queueCheckLazyElements);

        if (options.autoInit) {
            initLazyElements(); // standard initialization
        }
    });

So, if options.autoinit equals false, then initLazyElements() will not be called on document.ready():

        if (options.autoInit) {
            initLazyElements(); // standard initialization
        }

BUT it will be called on body.load event:

        $window
            .on(options.loadEvent, initLazyElements)

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?

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
alonsoysacommented, Dec 16, 2015

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.

0reactions
philschoefercommented, May 19, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent Conda from activating the base environment ...
Use sub-command conda config to change the setting. conda config --set auto_activate_base false. In fact, the former conda config sub-command is ...
Read more >
setting 'site_name' in config doesn't seem to work
Setting site_name in config seems to have no effect what so ever! $config['site_name'] = "Base ExpressionEngine Install";. Is there anything I'm ...
Read more >
How to modify the fcs# parameters in an IBM PureData ...
Step 1: Identifying adapters with incorrect settings. ... and the fcs# adapters that appear in the check command, then check with you system ......
Read more >
SRDebugger Updates - Stompy Robot
Properties and Methods with [Browsable(false)] attribute will not be displayed in the options tab (applies to SROptions and Option Containers).
Read more >
Full list of specifications for _slaaskSettings | Slaask Help Center
By defining a _slaaskSettings object in window, you can interact with our Slaask ... anonymousToken: "abCDefGHijKLmnOPqrSTuvWXyz", noCookie: false, options: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found