Isotope provides two places where you can supply callback functions:
container.isotope({
itemSelector: itemSelector,
layoutMode: 'fitRows',
onLayout: function() {alert('onLayout callback')}
}, function() {alert('anon callback')});
I don’t know what the difference between these two are – they both seem to be called exactly once, after the layout has completed. I’ve looked through the docs, but all I can find is
Similiar to a callback, onLayout is a function that will be triggered after every time an Isotope instance runs through its layout logic.
According to the source code, there is no difference. Three callback functions may be called when layout completes: the one passed in the final argument to
isotope(), the one passed in theonLayoutoption and the one passed in thecompletemember of theanimationOptionsoption.The relevant parts of the source are:
As you can see, an array is built with the three potential callbacks, and
callbackFn()calls each one in sequence if it’s a function.