Hi,
Masonry Grid work fine when rendered as a single instance (i.e. on a single view page or on the first / default tab of a quicktabs instance).
If
you have two tabs rendering the same view passing different arguement
then
the first one renders as expected but the others won't.
To be specific the images and text all overlap and render in a single column vertically.
Found a similar issue with other jQuery formatters views slideshow had a solution where the {'containerResize:TRUE / FALSE'} attrib had something to do with it.
Try this and see for yourself.
I would love some feedback or proposed solution to this.
cheers
kev
Comment | File | Size | Author |
---|---|---|---|
#27 | theme-js.js_.txt | 471 bytes | gsharm |
#17 | bootstrap_tabs--1835286--17.patch | 4.92 KB | Dom. |
Comments
Comment #1
klucid CreditAttribution: klucid commentedI have the same issue. Not sure if it is related, but the grid also breaks when an exposed filter is selected.
Comment #2
kvyn CreditAttribution: kvyn commentedI got this to work btw something to do with the scope of the masonry.js script.
hacked solution in pseudocode
preprocess page
if script not loaded
then
include and load masonry.js
end if
its late and i'm almost lights out. Hope this helps.
Comment #3
leahtard CreditAttribution: leahtard commentedHey kvyn,
I'm having the exact same issue. Are you able to share the code that helped you get it working?
Cheers, Leah
Comment #4
mattys CreditAttribution: mattys commentedi have the same problem...
Comment #5
DustinYoder CreditAttribution: DustinYoder commentedI am having the issue when using quicktabs to show 2 blocks from the same view. The first block renders the masonry correctly, but the hidden quicktabs tab doesn't run the masonry properly. I solved the issue by modifying the quicktabs.js file. I trigger the Drupal.attach behavior on the tab when it is made visible. This runs the masonry.js on the tab once it is visible. This seems to be a decent one line solution.
I wish I could find a simple way to modify the masonry module to make this work for all the cases where it is buggy, but this is just how I fixed the quicktabs problem. I'm sure it occurs in other situations as well.
I inserted this line before the return in Drupal.quicktabs.clickHandler function in quicktabs.js.
setTimeout(function(){Drupal.attachBehaviors(tab)}, 0);
Comment #6
KarlSheaThis worked for me:
Comment #7
Salif CreditAttribution: Salif commentedHi KarlShea
I have the same issue
Please can you show how did you apply your solution?
Comment #8
KarlSheaThe script I posted could go in any JavaScript file that's loaded on the same page as your QuickTabs instance.
Comment #9
Dom. CreditAttribution: Dom. commentedHi !
I'm just taking over maintainance. As part of cleaning the stack of issues, let me close this issue: I will support only 2.x and forthcoming version.
Thanks for comprehension.
Comment #10
kopeboy CreditAttribution: kopeboy commentedUnfortunately this isn't related to v1 only.
And it is happening with Bootstrap tabs too.
If you place a Masonry view in the first tab (shown by default on page load) it will work.
If you put it on any other tab, which requires you to click to show it, it won't: all the items will be overlapped on the left.
Comment #11
kopeboy CreditAttribution: kopeboy commentedI tried implementing this code in my theme script.js file: http://codepen.io/SitePoint/pen/mywEMR/
But it didn't work either :/
See the problem here: http://comprao.it/wear-freaky
Comment #12
Dom. CreditAttribution: Dom. commented@kopeboy: do you create the bootstrap tabs via a particular module or using a shortkey from a theme ? Do you input the code directly in your node article ? Do you embed your view in a template file ?
Comment #13
kopeboy CreditAttribution: kopeboy commented@Dom.
Yes, I created it using dev version of panels_bootstrap_styles module. Basically the node template is overridden with panels: there is a mini-panel inside, which has the "Bootstrap style: tabs" style provided by the said module; the mini-panel has 3 panes which are 3 views, one of them is using the masonry display.
I placed the code in my script.js files under my theme assets, which is invoked in the theme info file.
See this issue I opened there too (I am very frustrated): https://www.drupal.org/node/2594741
I tried with the Isotope module too (they have a masonry layout functionality as well), and the problem is the same.
A similar js code (http://jsfiddle.net/Vc6Vk/) didn't fix it either.
Comment #14
kopeboy CreditAttribution: kopeboy commentedComment #15
Dom. CreditAttribution: Dom. commentedI'm currently in a situation where I lack time a lot ! I will have a look ASAP since the correction shouldn not be that hard I guess: just refreshing masonry on the 'shown.bs.tab' event would be enough.
Comment #16
kopeboy CreditAttribution: kopeboy commentedYes, because a browser window resize fixes it..
Comment #17
Dom. CreditAttribution: Dom. commentedHi !
Can you test this patch and let me know ? It is not actually that easy to make both work, specially when there are multiple Masonry display on a same page.
The patch attached does reinit *ALL* masonry display on page, not only the one in tab.
Comment #18
Dom. CreditAttribution: Dom. commentedComment #19
Dom. CreditAttribution: Dom. commentedDid you get any opportunity to test my patch ?
Comment #20
johnkareoke CreditAttribution: johnkareoke as a volunteer commentedI've tested this patch and it works, in my case in a panel.
Thanks @Dom.!
Comment #22
Dom. CreditAttribution: Dom. commentedPatch #17 commited in dev branch. Will be included in next release.
Comment #23
Dom. CreditAttribution: Dom. commentedComment #26
markdcNeither #6, the patch in #17, or the latest dev is working for me.
Just to confirm that I'm having the same issue: if the Quicktab that has Masonry isn't loaded first, the overlapping occurs until window resize. Selecting another tab, resizing the window again, and going back to the Masonry Quicktab causes the overlapping again.
My structure:
Bootstrap Theme (3.16) > Panel (3.9) > Quicktabs (3.8) > Mini Panel > Views Masonry
My Masonry Views settings:
.masonry-item {margin: 10px; padding: 20px; width: 329px;}
My Quicktab settings:
I have these Quicktab patches applied (in case one of them could be interfering):
If you can give me any clues what might be causing the problem, or another kind of workaround, I would be very appreciative. Thanks.
Comment #27
gsharm CreditAttribution: gsharm at Srijan | A Material+ Company commentedI have created quicktab with Renderer as a bootstrap tabs added 4 views block. The first block renders the masonry correctly, but another bootstrap tabs views masonry content styling not properly.
This code worked for me:
i have created one custom js file added in theme js folder then copy and paste below code in theme custom js file.