verlok / vanilla-lazyload

LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
https://www.andreaverlicchi.eu/vanilla-lazyload/
MIT License
7.66k stars 675 forks source link

Uncaught TypeError: Cannot read property 'classList' of null #30

Closed akroii closed 8 years ago

akroii commented 8 years ago

I'am using

jQuery 2.1.4

new LazyLoad({
        container: "imageContainer",
            data_src: "src",
            data_srcset: "srcset",
            show_while_loading: true

        });

--> _supportsClassList = !!document.body.classList;

akroii commented 8 years ago

my fault, you need to move the options to end of </body>

akroii commented 8 years ago

hmm Cannot read property 'querySelectorAll' of null in line 421: this._elements = _convertToArray(this._queryOriginNode.querySelectorAll(this._settings.elements_selector));

Update: solved by myself: be carefull of your elements_selector and container options

verlok commented 8 years ago

Can you detail what is your HTML and JS code like? If you don't, I can't debug my script.

verlok commented 8 years ago

Great!