Disable jQuery Masonry

I am trying to disable jQuery masonry for certain page states on my site, but can't seem to find a way to do this. Do you know how I can do this? Thank.

+5
source share
2 answers

Here is a list of methods http://desandro.imtqy.com/masonry/docs/methods.html#content

Assuming your Freemasonry container id is #masonry

$('#masonry').masonry( 'destroy' );
+6
source

I used @kaverzniy answer, but wrapped it in

var container = $('#container'); // or whatever your container is
if(container.masonry()) {
    $('#masonry').masonry( 'destroy' );
}

to avoid calling methods on the masonry before initialization (if it has not yet been initialized).

+2
source

All Articles