Uncaught ReferenceError: Masonry is not defined
-
I have a Masonry script which isn’t in a .js, but placed in footer.php.
I’ve made the script to be called only for the index.php, so it shouldn’t try to load anywhere else.
When I’m on other pages, the console display this error:
Uncaught ReferenceError: Masonry is not defined at (index):82
Highlighting this section:
var msnry = new Masonry('.js-masonry', {
When I’m on index.php, it works fine without any errors, but visiting other pages that does not require the script to be loaded, the error appears in the console log.
I know it’s not the best method to place the script in the footer.php, but it works there, whereas when I try to put it into a .js file it gives me$ is not a function
.How do I go about this?
- The topic ‘Uncaught ReferenceError: Masonry is not defined’ is closed to new replies.