brunjo / rowGrid.js

A small, lightweight JavaScript plugin for placing items in straight rows (jQuery and vanilla JS version) – Demo:
http://brunjo.github.io/rowGrid.js/
MIT License
670 stars 78 forks source link

Sometimes i get width: 0px. #34

Closed febyolaaldo closed 6 years ago

febyolaaldo commented 6 years ago

When i try to reload again, everything is running well. But, when i try to clear cache, i get width: 0px again. What can i do? image

brunjo commented 6 years ago

I guess the images inside the figure element aren't loaded yet. You should make sure you call rowGrid only after all images are loaded. Alternatively, you could add the width and height of the images as attributes to the img elements like this: <img src="…" width="200" height="160"

febyolaaldo commented 6 years ago

yeah, fixed with setTimeout function. Thanks @brunjo