Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Does/will this new release of the masonry api support the new release of the masonry js that was released over the weekend? (Please? :) )
Comments
Comment #1
BWPanda CreditAttribution: BWPanda commentedYes.
Unfortunately I only noticed the new Masonry version just after releasing v2.0 of Masonry API, otherwise I would have held off until I had support for it built in.
As it is, I will release a new version of Masonry API (v2.1) that will require v3 of the Masonry library. Stay tuned!
Comment #2
linclark CreditAttribution: linclark commentedThis patch seems to work for converting from v2 to v3.
To use this patch, you must create a directory for imagesloaded in the libraries directory and then download the images loaded JS from http://desandro.github.io/imagesloaded/imagesloaded.pkgd.min.js. You must also download Masonry v3 from http://masonry.desandro.com/ and put it in your masonry libraries directory.
Comment #3
lavamind CreditAttribution: lavamind commentedPatch in #2 looks good, but as of version 3.1.1 several options and method names have changed in the javascript library.
Here is a patch which incorporates #2 and adds the necessary changes to
masonry.js
Comment #4
Andre-Bwill test this later as masonry 2.x breaks qtip2 due to imagesLoaded Plugin.
update:
works like a charm. In order to get it working with #1808018: Make work with Views Infinite Scroll I had to change the patched
to
Comment #5
queenvictoria CreditAttribution: queenvictoria commentedHere is a patch and interdiff to support Views Load More. In v3.1.2 (at least) we need to call 'layout' after 'reloadItems'.
See https://drupal.org/node/1907272.
NB:This might also suit Views Infinite Scroll.
EDIT: Oops whitespace errors. Sorry.
Comment #6
queenvictoria CreditAttribution: queenvictoria commentedComment #7
VVS CreditAttribution: VVS commentedThis patch not working for https://drupal.org/project/masonry_views. On views format settings:
These options have been disabled as the jQuery Masonry plugin is not installed.
In admin/reports/status: jQuery Masonry 3.1.4, jQuery Update jQuery 1.7.1
Upd: sorry lib imagesloaded dos'nt installed…
Comment #8
zmove CreditAttribution: zmove commentedAny commit soon to make it works with masonry 3 ?
Comment #9
NitebreedTested #5, works great!
Comment #10
T.Mardi CreditAttribution: T.Mardi commented@ #7 I'm having the same issue in views, getting the message 'These options have been disabled as the jQuery Masonry plugin is not installed.' I've checked my libraries folder and have imagesloaded.pkgd.min.js there. How did you fix the error?
Comment #11
donlucas CreditAttribution: donlucas commentedTested #5.
Works great. Now even works with
-module and as guessed in #5 with Views Load More-module.
@ #10:
i had the same issue.
• I changed my versions of masonry.pkgd.min.js to (v3.1.5) & imagesloaded.pkgd.min.js to (v3.1.4). i don't know if this is required, but it works for me.
• do you have your .js in a libraries-subfolder? (sites/all/libraries/imagesloaded/imagesloaded.pkgd.min.js) and the same for (sites/all/libraries/masonry/masonry.pkgd.min.js)
again, i don't know if this is required or not.
• changed my jQuery version back to 1.7
• clear caches(?)
• run a dbupdate(?)
Comment #12
T.Mardi CreditAttribution: T.Mardi commentedThanks donlucas, I didn't have imagesloaded in a separate directory in the libraries folder. Did that and it worked!
Comment #13
Leon Kessler CreditAttribution: Leon Kessler commentedI'm getting the following JavaScript error in my console when clicking on an Ajax filter:
cannot call methods on masonry prior to initialization; attempted to call 'reloadItems' masonry.pkgd.min.js?n3gq9w:9
cannot call methods on masonry prior to initialization; attempted to call 'layout' masonry.pkgd.min.js?n3gq9w:9
cannot call methods on masonry prior to initialization; attempted to call 'reloadItems' masonry.pkgd.min.js?n3gq9w:9
cannot call methods on masonry prior to initialization; attempted to call 'layout'
Seems like masonry needs to be re initialization on each Drupal.behaviors call. Not sure why though, it's the same container so should pick up the same instance of masonry.
I changed
$container.masonry('reloadItems').masonry('layout');
to
$container.masonry().masonry('reloadItems').masonry('layout');
And it worked. But I don't think the extra masonry() should be required.
Comment #14
Leon Kessler CreditAttribution: Leon Kessler commentedI guess views Ajax replaces the div with a new one. Will double check this but makes sense.
It does work with the load more pager, again this makes sense as it just adds to the existing container (it doesn't replace everything).
I think really there should be a check to see if masonry needs to be initialised (and if not, do it). I will take a look at this tomorrow.
Comment #15
Leon Kessler CreditAttribution: Leon Kessler commentedFixed by using once() and checking if container has already been processed. This should have been on there anyway (it's a better way to check than
context == document
)Patch attached (applies to current dev branch).
Comment #16
Leon Kessler CreditAttribution: Leon Kessler commentedComment #17
tripper54 CreditAttribution: tripper54 commentedWorks for me, thanks leon.nk and others.
Comment #18
hefterbrumi CreditAttribution: hefterbrumi commentedIs #13 already in the DEV?
During patching it says previously applied patch detected...
Comment #19
tripper54 CreditAttribution: tripper54 commentedComment #20
nsciaccaI added support for Stamps and using CSS selector as the columnWidth setting. If you use the CSS selector you need to include your sizer into the template file and set the item widths via CSS.
Comment #21
AaronBaumancouple issues:
* latest patch doesn't apply cleanly
* to properly add the imagesloaded requirement, masonry_requirements() in masonry.install needs to be updated as well
Comment #22
AaronBaumanre-roll of #20 @dev, adding imagesloaded to hook_requirements
Comment #23
AaronBaumanaaaaand fixed a typo
Comment #24
zanixWorks for me
This even fixes compatibility with Views Infinite Scroll
Once patches #44 and #50 from #1806628: Support Masonry module are applied
Comment #25
kopeboy CreditAttribution: kopeboy commented#23 have whitespace errors ?
sites/all/modules/masonry/masonry-support_3_0-2022371-23.patch:73: trailing whitespace.
sites/all/modules/masonry/masonry-support_3_0-2022371-23.patch:74: trailing whitespace.
Comment #26
kopeboy CreditAttribution: kopeboy commented@zanix Which patch of these fixes it for you?
Comment #27
kopeboy CreditAttribution: kopeboy commentedI tried patching Masonry with patch #23 here, than Views Infinite Scroll with the patches you linked, #44 applied, but #50 gives Hunk #1 FAILED at 74.
Did you have any other patch on VIS before applying #50, or any patch on masonry_views?
Comment #28
zanix@kopeboy patch #23
I didn't get those white space errors you are getting though.
I think this was the only patch I applied to masonry, I could double check.
Comment #29
zanixOk, looking at the patch I see there is trailing spaces on lines 73 and 74. The patch command on my system doesn't seem to care about those lines.
I also noticed that the patch added one space to the tab indenting for masonry.js which is bad formatting.
I re-rolled patch #23 to remove the trailing spaces and fix the formatting.
Comment #30
newme154 CreditAttribution: newme154 commentedi have the files in the correct place (at least I think but i'm still getting an error in views that it cant find the library files.
the path i have is sites/all/libraries/Masonry/ and sites/all/libraries/imagesLoaded/
Why arent they working?
Comment #31
zanixThe library files need to look like this (no capitol M or L)
Comment #32
newme154 CreditAttribution: newme154 commentedjust as i thought. Thats exactly how i have it. still no go.
Comment #33
newme154 CreditAttribution: newme154 commentedthis is probably not the place to put this, but i've added both of the files to the libraries directory as listed in #31. i can select Masonry from the views format, but in the settings i get the dreaded "These options have been disabled as the jQuery Masonry plugin is not installed." over and over again. tested the js and its all there. no breaks in anything. any ideas? anyone?
Comment #34
zanixWhat does the Drupal Status report page (/admin/reports/status) say?
Comment #35
newme154 CreditAttribution: newme154 commentedat first it said that it couldnt find the jQuery Masonry Plugin, then i changed the paths and now it shows success. but i get the same error in the views.
Comment #36
zanixOnce you get the status page to recognize that masonry is detected, clear caches and try setting the view to masonry again.
Comment #37
dman CreditAttribution: dman commentedPatch mostly works good!
The dependence on jquery_update, and this new imagesloaded lib is currently undocumented, so it was quite frustrating to upgrade to.
So I'm adding an INSTALL.txt.
Small bug - the new version of masonry takes an element selector as the argument to columnWidth http://masonry.desandro.com/options.html#columnwidth
When setting the columnWidth to (eg) 200 in the options, this was getting passed through the JSON settings as a string "200" not an int, and then the js tried to look for the element named "200". (and everything broke and all my items ended up in a pile at 0x0 on the axis.)
So I'm checking the masonry_column_width input from the options form and casting it to an int if needed.
I can't seem to get column_width with percentages working well.
With some repairs, It can work once, but if the container resizes (responsive) then it's not recalculated. Looks like the old module code used a callback that is not in the new library.
With good element and css support, maybe we can drop the percentage option. Looks like it was tacked on at this end, rather than an actual masonry feature.
Comment #38
dman CreditAttribution: dman commentedAdded INSTALL.txt, integer widths on elements, and half-support for percentage widths
Comment #39
kammyel CreditAttribution: kammyel commentedHello Everyone, Is there a way to work with corner stamps? I would like to add the View Header as first element, and make the rest of the elements wrap around this element, apparently the last Masonry views module doesn't support this and I would like to know if there is any update I could use to make it work.
Thank you!
Comment #40
tripper54 CreditAttribution: tripper54 commented@kammyel, this sounds like a separate issue to me. Your best chance of getting support is to open a new issue.
Comment #41
kopeboy CreditAttribution: kopeboy commented@dman
You confirm that this will work with a CSS selector (CSS class input in the View) and a width setting (both pixels and percentages) in the CSS files, right?
Comment #42
dman CreditAttribution: dman commentedI used it with pixel widths (variable on responsive breakpoints) with classes set on the elements (in panels settings and display suite), and css.
Worked there.
Haven't had a use for percentages, as we use breakpoints in theme. It should work if you try it though.
Comment #44
Dom. CreditAttribution: Dom. commentedCommited on 7.x-3.x branch.
Thanks a lot to all !
Comment #46
ean CreditAttribution: ean as a volunteer commentedMasonry API version = "7.x-3.0-beta1"
Views Infinite Scroll="7.x-1.2+1-dev"
I have the same error post #13
cannot call methods on masonry prior to initialization; attempted to call 'reloadItems' masonry.pkgd.min.js?n3gq9w:9
cannot call methods on masonry prior to initialization; attempted to call 'layout' masonry.pkgd.min.js?n3gq9w:9
Solve
$container.masonry().masonry('reloadItems').masonry('layout');
Comment #47
Dom. CreditAttribution: Dom. commented@ean
Please open a new issue if still issuing on this.
Dom.