codrops/GridLayoutScrollableContent

Trying to implement in Wordpress website but get Uncaught TypeError from demo.js

Opened this issue · 0 comments

So i'm trying to turn this script into a shopping grid for WordPress through a plug-in called Addon Creator for WPBakery Page Builder, I can use custom HTML, CSS and more to easily create addons for Visual composer.

Now the problem, I've added all the JS and CSS to the addon creator and copy pasted the HTML of the gridlayout script into the addon creator for WordPress. It all works (loading images, HTML etc.) except for something in the Demo.js. I get this exact error

'Uncaught TypeError: Cannot read property 'parentNode' of null
at new Grid (demo.js:284)
at demo.js:532'

These are the lines:

class Grid { constructor(el) { this.DOM = {el: el}; // The grid wrap. this.DOM.gridWrap = this.DOM.el.parentNode;

// Initialize the Grid. const grid = new Grid(document.querySelector('.grid'));

I'm an absolute tool with JS/jQuery so any help would be greatly appreciated!