toddmotto / echo

Lazy-loading images with data-* attributes

Home Page:http://toddmotto.com/labs/echo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error "TypeError: root.removeEventListener is not a function" when using RequireJS

hilja opened this issue · comments

commented

I'm trying to load the script with RequiJS and I get and error "TypeError: root.removeEventListener is not a function".

My config.js file:

require.config({
    paths: {
        echo: '../../dist/lib/echo'
    },
    deps: ['modules/app']
});

Then in app.js:

define(function(require) {
    var echo = require('echo');
    echo.init({
        offset: 100,
        throttle: 250,
        unload: false,
        callback: function(el, op) {
            el.style.opacity = 1;
        }
    });
}
commented

I use the webpack to require echo, meet the same problem.