Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property 'settings' of undefined #397

Open
tsechingho opened this issue Nov 1, 2017 · 12 comments
Open

Cannot set property 'settings' of undefined #397

tsechingho opened this issue Nov 1, 2017 · 12 comments

Comments

@tsechingho
Copy link

I use jquery-lazyload 1.9.7 with reactjs, it works well.
I try to use lazyload 2.0.0-beta.2 with reactjs, I got errors like

Uncaught (in promise) TypeError: Cannot set property 'settings' of undefined
    at LazyLoad (lazyload.js:78)

my react component call lazyload like

  componentDidMount() {
    const images = this.node.querySelectorAll('.lazyload')
    lazyload(images, {
      threshold: 200,
    })
  }

I think it should be a bug.

@aaryan79831014
Copy link

I am using lazyload 2.0.0-beta.2, I encounter the same problem. Comes up with

Cannot set property '_settings' of undefined

@pherrymason
Copy link

I had the same problem and it was because I was not calling properly Lazyload.
Initially I was doing this:

var lazyload = require('lazyload.js');
lazyload();

But, what I should do is:

var lazyload = require('lazyload.js');
var obj = new lazyload();

@coalo
Copy link

coalo commented Jan 10, 2018

I have same problem, who can solve it

@singee77
Copy link

singee77 commented Feb 6, 2018

I have same problem in amd.
TypeError: Cannot set property 'settings' of undefined at e (lazyload.min.js?v=1.0.0:formatted:7) at Object.execCb (require.js:1696) at Module.check (require.js:878) at Module.enable (require.js:1176) at Module.init (require.js:788) at callGetModule (require.js:1203) at Object.completeLoad (require.js:1590) at HTMLScriptElement.onScriptLoad (require.js:1717)

@spraxis
Copy link

spraxis commented Mar 4, 2018

Same here. I added the library with requirejs and then:
$('img.lazyload').lazyload();

The error:

lazyload.js:78 Uncaught TypeError: Cannot set property 'settings' of undefined
    at LazyLoad (lazyload.js:78)
    at Object.execCb (require.js:1650)
    at Module.check (require.js:866)
    at Module.enable (require.js:1143)
    at Module.init (require.js:774)
    at callGetModule (require.js:1170)
    at Object.completeLoad (require.js:1544)
    at HTMLScriptElement.onScriptLoad (require.js:1671)

@ghost
Copy link

ghost commented Mar 21, 2018

@spraxis have u found a solution?

@nicklee
Copy link

nicklee commented Apr 11, 2018

Getting the same error here too! Would love to hear if anyone has a solution…

@webkulabhi
Copy link

getting same here also.

@Sogl
Copy link

Sogl commented Jun 27, 2019

Same here. Any ideas?

@burmesepotato
Copy link

Anyone found a solution yet?

@cYang2030
Copy link

Do not use lazyload() instead of new lazyload()

@zayan011
Copy link

Same error i have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests