flexmasonry
flexmasonry copied to clipboard
refresh method
Hi, How would I use the refresh method? I've tried to refresh the grid with the click of a button, but that doesn't work.
const fm = FlexMasonry.init('.grid', {
breakpointCols: {
'min-width: 960px': 5,
'min-width: 768px': 4,
'min-width: 576px': 3,
'min-width: 450px': 2,
}
});
document.getElementById('refresh').addEventListener('click', function() {
fm.refresh();
});
Could you please tell me what I'm doing wrong? Sorry, I'm having a very limited understanding of Javascript. My apologies for that.
Thank you Klaas
So you can either use refreshAll
:
FlexMasonry.refreshAll();
Or you can refresh an individual grid:
var grid = document.getElementById('my-grid');
FlexMasonry.refresh(grid);