lazyload icon indicating copy to clipboard operation
lazyload copied to clipboard

Cannot set property 'settings' of undefined

Open tsechingho opened this issue 7 years ago • 11 comments

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.

tsechingho avatar Nov 01 '17 04:11 tsechingho

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

Cannot set property '_settings' of undefined

aaryan79831014 avatar Dec 07 '17 14:12 aaryan79831014

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();

pherrymason avatar Dec 10 '17 17:12 pherrymason

I have same problem, who can solve it

coalo avatar Jan 10 '18 09:01 coalo

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)

singee77 avatar Feb 06 '18 02:02 singee77

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)

spraxis avatar Mar 04 '18 22:03 spraxis

@spraxis have u found a solution?

ghost avatar Mar 21 '18 12:03 ghost

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

nicklee avatar Apr 11 '18 10:04 nicklee

getting same here also.

webkulabhi avatar Feb 04 '19 12:02 webkulabhi

Same here. Any ideas?

Sogl avatar Jun 27 '19 20:06 Sogl

Anyone found a solution yet?

burmesepotato avatar Aug 06 '19 10:08 burmesepotato

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

cYang2030 avatar Sep 26 '19 05:09 cYang2030