Thank you
Actually as said above, I’m able to make the jQuery version work but not Vanilla one.
So my problem is that when i use Vanilla js it doesn’t work and i get the error above
Vanilla version : https://codepen.io/desandro/pen/BgcCD
Can you show us your actual script? Your error says that Isotope is not defined, which means it isn’t being imported correctly. Are you importing the class as shown in the docs I linked?
Isotope successfully included with yarn add Isotope-layout
In app.js : import ‘isotope-layout/dist/isotope.pkgd.min.js’;
var elem = document.querySelector('.grid-filter');
var iso = new Isotope( elem, {
// options
itemSelector: '.col',
layoutMode: 'fitRows'
});
// element argument can be a selector string
// for an individual element
var iso = new Isotope( '.grid-filter', {
// options
});
It works fine when i link directly to Isotope files like this: <script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>
jQuery uses a different loading process to the module system used by imports. It probably puts something in the global scope, while the imported vanilla version is more specifically scoped by the webpack build process.