• Resolved balux

    (@balux)


    Hi, in the console I have this error. This happens in any page/post and is breaking other plugins. Any idea where it comes from or any quick fix?

    It seems located in kai/js/script.js

    imagesLoaded( container, function() {
            msnry = new Masonry( container, {
                // adjust to match your own block wrapper/container class/id name
                itemSelector: '.post-item',
                // option that allows for your website to center in the page
                isFitWidth: true,
                gutter: 10  
            });
        });

    Thanks

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter balux

    (@balux)

    well I’ve luckily fixed it myself.

    In /wp-content/themes/kai/js/script.js

    you need to wrap the following

          imagesLoaded( container, function() {
              msnry = new Masonry( container, {
                  // adjust to match your own block wrapper/container class/id name
                  itemSelector: '.post-item',
                  // option that allows for your website to center in the page
                  isFitWidth: true,
                  gutter: 10  
              });
          });

    into an if statement to check container. Like this:

        if(container !== null){
          imagesLoaded( container, function() {
              msnry = new Masonry( container, {
                  // adjust to match your own block wrapper/container class/id name
                  itemSelector: '.post-item',
                  // option that allows for your website to center in the page
                  isFitWidth: true,
                  gutter: 10  
              });
          });
        }
    • This reply was modified 4 years, 7 months ago by balux.
Viewing 1 replies (of 1 total)
  • The topic ‘TypeError: e is null (in pages and posts)’ is closed to new replies.