• Resolved myeternaltrails

    (@myeternaltrails)


    Hi,

    I am getting one error very frequently on my post using Masonry Style which is caught on console and says that “Uncaught ReferenceError: Masonry is not defined”.
    Sometimes, it works fine and gallery appears on my post, but 90% of time, it doesn’t.

    Can you anyone suggest what can be done to solve this problem ?

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author bradvin

    (@bradvin)

    Hi

    I had a look at your site and your scripts are loading async, which means they all load in parallel and there is no way to guarantee the masonry is loaded before the foogallery script. This causes the foogallery script to fail because the masonry script is not loaded into memory at that time.

    What plugin are you using to load scripts async? I suggest you disable async for both foogallery and masonry in that plugin’s settings

    Thread Starter myeternaltrails

    (@myeternaltrails)

    Hi Bradvin,

    Thanks for your response.

    I was using some code in my functions.php to load scripts async. Though I added foogallery.min.js to list of files to be excluded, it didn’t work.

    Now I have changed this code to defer the scripts rather than async, and seems like it’s working fine now, without excluding foogallery.min.js

    If you have any recommendations, kindly let me know.

    Plugin Author bradvin

    (@bradvin)

    I do not recommend loading scripts async because then the loading order of scripts loaded by WP is ignored. The scripts then run when they load, which means on slower connections your site could have javascript errors when code runs before dependancies are loaded.

    Thread Starter myeternaltrails

    (@myeternaltrails)

    Okay Bradvin, Thanks for your recommendation and help !

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘FooGallery : Uncaught ReferenceError: Masonry is not defined’ is closed to new replies.