callmecavs / layzr.js

A modern lazy loading library for images.

Home Page:http://callmecavs.com/layzr.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nothing happening and 'forEach' error on using instance.check()

Bram-Zijp opened this issue · comments

Installed the plugin through npm i --save layzr.js
In my app.js file i include the module like so

import Layzr from 'layzr.js'
const lazy = Layzr()
lazy.check()

When I added the lazy.check() the following error popped up:

Uncaught TypeError: Cannot read property 'forEach' of undefined
    at Object.check (eval at ../node_modules/layzr.js/dist/layzr.module.js (bundle.js:761), <anonymous>:186:10)

in my index.php I have images like so:

<img data-normal="test.jpg">

I'm using Webpack 2.2.0

Had to do something with my paths of which the views where served

const lazy = Layzr()

lazy
    .update()
    .check()

in this way?