bigbite / macy.js

Home Page:http://macyjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add class to container when Macy is initialized?

nickpish opened this issue · comments

First off, thank you for a fantastic light-weight masonry plugin! I'm wondering how I might add a macy-init class to the container element when Macy has initialized? I've tried the following using an event key, but it doesn't seem to be working:

let macy = Macy({container: '.container'});
macy.on(macy.constants.EVENT_INITIALIZED, function() {
   var container = document.querySelector('.container');
   container.classList.add('macy-init');
});

Thanks for any insight here.

commented

You can edit the source code. In setup function, add the async function to wrap "emit EVENT_INITIALIZED". But this may not be logical. I think the best way to resolve this question is to extract an initalization lifecycle function.