I have this code that does not work. I know why it does not work - first time page is loaded 'context' is all page and jquery easely finds '.view-SPECIFICVIEW .view-content'. After AJAX 'context' has changed and it is now just '.view-SPECIFICVIEW' and inside that there is no class '.view-SPECIFICVIEW' and therefore nothing happens. Script works if I remove '.view-SPECIFICVIEW' from find(), but then all views are selected.
(function ($, Drupal, window, document, undefined) {
Drupal.behaviors.MYMODULE = {
attach: function(context, settings) {
$(context).find('.view-SPECIFICVIEW .view-content').masonry({
columnWidth : 300,
gutterWidth : 20
});
}
}
})(jQuery, Drupal, this, this.document);
I would like to have this code to work with '.view-SPECIFICVIEW' and also I would like to know how code changes if multiple, different specific views should be targeted.