I'm using justifiedGallery for my web page. When I visit the page at first time, the gallery appears correctly. But when I reload the page, it'll break.
I'm using meteor and react.
Old code sample:
$(document).ready(() => {
$('#gallery').justifiedGallery({
rowHeight: 400,
fixedHeight: false,
lastRow: 'justify',
margins: -3,
});
});
I've put it to jQuery setTimeOut() function.
setTimeout(function(){
$('#gallery').justifiedGallery({
rowHeight: 400,
fixedHeight: false,
lastRow: 'justify',
margins: -3,
});
}, 100);
Now it's working fine. I just need to know that this is the correct way of fixing it? This is for the future proof.