Reputation: 133
I'm trying to disable jQuery masonry for certain states of a page on my site but can't seem to find a way to do it. Do you know how I could do this? Thanks.
Upvotes: 6
Views: 5527
Reputation:
I used @kaverzniy's answer but wrapped it in
var container = $('#container'); // or whatever your container is
if(container.masonry()) {
$('#masonry').masonry( 'destroy' );
}
to avoid calling methods on masonry prior to initialization (in case it hadn't been initialized yet).
Upvotes: 2
Reputation: 340
Here is the list of methods http://desandro.github.io/masonry/docs/methods.html#content
Assuming your Masonry container ID is #masonry
$('#masonry').masonry( 'destroy' );
Upvotes: 8