bigbite / macy.js

http://macyjs.com/
MIT License
1.3k stars 156 forks source link

Add class on positioning #31

Closed Epenance closed 7 years ago

Epenance commented 7 years ago

Would it be possible to add a param to the initiation block that would make it possible to add a class once the item has been positioned?

I just released https://redditgrid.com using this lib, but im running into some issues with stuff being shown through the currently played pictures by the ones behind while they are being positioned, it would be idea to be able to simply add a class to the element and i could use to toggle opacity on the block once its loaded.

Also it could be used for some fancy CSS effects later on :)

jrmd commented 7 years ago

Hi @Epenance

The site is looking great, its good to see macy out in the wild :) currently this is something thats not yet implemented, but i could look at adding it in.

Although as an alternative solution, you could target the data attribute that is attached to the completed items data-macy-complete in css you could do something like this

app-image-thumbnail {
 /* add styles for not loaded */
}

app-image-thumbnail[data-macy-complete="1"] {
 /* add styles for when loaded */
}
Epenance commented 7 years ago

Thanks for the quick reply, i literally figured that out the second i posted the issue, just didnt have time to both test it out and delete the issue :P

jrmd commented 7 years ago

Awesome, let me know how it goes. I'll close this issue for now but if you have any problems just reopen.