Reputation: 7969
Masonry is not working when we are trying to initialise it with jQuery method. But it is working fine with vanilla javascript. jQuery is loaded in our master page and it is available globally. Am I missing something. fiddle
require(['https://npmcdn.com/[email protected]/dist/masonry.pkgd.min.js'],function(masonry){
$('.grid').masonry({
// options
itemSelector: '.grid-item',
columnWidth: 200
});
})
Upvotes: 0
Views: 94
Reputation: 4524
Give this a try. Here is a link from the Masonry site to use require.
requirejs([
'https://npmcdn.com/[email protected]/dist/masonry.pkgd.min.js',
], function(Masonry) {
new Masonry('.grid', {
});
});
Upvotes: 2