steveush
Forum Replies Created
-
Hi Dave,
The portfolio template uses the newer CSS flexbox for layout, so it should be slightly easier to get the look you are after. The below CSS should do it:
.foogallery.fg-simple_portfolio { align-items: center; }Thanks
SteveHi @riflebird,
I believe the issue here is your theme sets the following CSS on the
imgelements within the gallery:.row .col img:not([srcset]) { width: auto; }This CSS causes the browser to not apply the aspect-ratio properly. I’m not sure why theme developers have started using this but it has popped up in the last few weeks and has caused us a few issues.
I believe the CSS @bradvin gave you will correct the issue however we need to make the CSS selector for the class more specific or else your theme’s CSS overrides it.
Please try the following modified selector:
.fg-masonry.fg-fixed .fg-item .fg-image { width: 100%; height: auto; max-width: 100%; }If that is still not applying correctly please let me know.
Thanks
SteveHi @sybilrondeau,
For the first issue where the buttons are too close, this is a small conflict with your theme. The
widthproperty on the buttons is being set toautoinstead of the expected100%which is the root cause of the issue however there are also some other default values being overridden. Adding the following CSS to your page should correct the conflict and let the defaults be used:button.fg-panel-button { display: inline-block; text-align: center; width: 100%; padding: 1px 6px; border-width: 0; cursor: pointer; }I also see some custom CSS in your linked page already targeting the
fg-panel-buttonCSS class. I’m not exactly sure but it looks like you want to remove the borders from the buttons all together? You can do that by simply adding!importantto theborder-widthvalue above.As for the second issue, the ability to swipe has not been implemented on videos. The problem is when you swipe on a video it actually happens inside the
<iframe/>which is not controlled by us but rather by the site hosting the video. I haven’t thought of a clean solution which would not cause more issues than it solved.Thanks
SteveHey @ronaldfuchs2016
That’s good to hear that it resolved most of the issues for you. I forgot that the new version also checks the average height for all rows and makes sure the last row does not exceed that value by more than 10%. This was a measure to try and counter the situation where the last row contained a single small image which was then blown up to huge proportions in an attempt to make it fit width wise. So in the cases where it is not working for you I assume it would result in an abnormally large image in the last row compared to the rest of gallery and so constrains it to make it fit in.
We’ll be adding the last row option back in but in a slightly different format. At present it will have only three values to choose from;
1. The current default behavior which adheres to the max row height and checks the average of all previous rows.
2. Then it will have the option to simply force justify the last row letting it ignore the max row height constraint and average of the previous rows, this is effectively the same as the old justify behavior but you could once again end up in some cases where you have extremely large last row images.
3. Then finally it will have the option to simply hide the last row if it does not fill the entire space to satisfy @mcbightonbrian’s use case.Thanks
SteveHi @ronaldfuchs2016,
The last row is always justified now, the difference is the new version adheres to the max row height essentially fixing a long standing bug in the previous version. So the image is never expanded past the max height, the last row is simply aligned to left, right or center. That is why the justify and nojustify options for the last row option became redundant and were removed. Please try adjusting your max row height if you want images in the last row to grow larger than they currently are.
@mcbightonbrian we’ll look at adding back the hide last row option for your use case.
Thanks
SteveHi @looknsharp,
I don’t think changing the file name caused the issue. I believe the issue here is that the
relattributes have changed and FooBox does perform some automatic merging of elements using the samerel.FooBox is looking to bind to the
wp-block-imageelements under your device setup guide but they contain a commonrelattribute with the images from the above Jetpack Tiled galleries.FooBox automatically pulls in all images that share the same
relattribute. So what is happening here is that it is binding to the first image under the device setup guide, so it appears first in the lightbox, then it is checking the rest of the page for any other images sharing the samerelattribute and merging them into its contents.This results in a mismatch of what is seen in the page to what is displayed in the lightbox as the second image appears higher in the page order than the first.
As it stands at the moment in the free version the best bet is to alter the
relattributes for each of the images you have displayed under your device setup heading.In the Gutenberg editor, once an image is selected, click the “link” button in the top menu, on the right hand side is a drop down arrow and under there you should see the
reloption for the image.You should be able to keep whatever currently exists, I believe it should show
external noopener noreferrerat the moment. Just add a unique name for the images you want grouped together in the lightbox. For example you can addlightbox-1to each of the images so thererelattribute ends up beingexternal noopener noreferrer lightbox-1and it should resolve the issue.Thanks
SteveHey @generalnumpty,
No problem, for clarification:
#1 was in the individual gallery settings, #2 & #3 can be added to your own styles.css file that is included with your theme for example.
The Gallery Settings > Advanced > Custom Gallery Class that I am referring to is on the individual gallery settings pages as well. In the Gallery Settings metabox there is a tab called Advanced and in there is an option called Custom Gallery Class which allows you to add a custom CSS class to the gallery.
So the way to implement #2 & #3 would be to add the CSS to your custom stylesheet and then go to the individual gallery settings page to change the options and/or add the
custom-colsclass if implementing #2.Thanks
SteveHey @generalnumpty,
You seem to be on the right track. The renaming of the CSS is correct in your example above. Overall there’s 3 methods I have provided you here so let me break them down to be a little clearer:
1. The first method was the gallery specific changes that looked like the below:
/* 6 column layout on desktop */ #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 15.66%; } #foogallery-gallery-1 .fg-column-width { width: 15.66%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; }2. The second method was a general method you could use globally for any gallery by setting the layout to any of the column options and then setting the Gallery Settings > Advanced > Custom Gallery Class option to
custom-cols. That looks like the below:/* 6 column layout on desktop */ .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(16.66% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(16.66% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; }3. Then there was the method to skip having to set the Gallery Settings > Advanced > Custom Gallery Class option by replacing the
custom-colsCSS class in #2’s CSS with the 5 column class name, effectively overriding that layout entirely:/* 6 column layout on desktop */ .foogallery.fg-masonry.fg-masonry-5col .fg-item { margin-bottom: 1px; width: calc(16.66% - 1px); } .foogallery.fg-masonry.fg-masonry-5col .fg-column-width { width: calc(16.66% - 1px); } .foogallery.fg-masonry.fg-masonry-5col .fg-gutter-width { width: 1px; }Ok, so now that I have broken down those 3 methods let me go over them a little.
#1 worked but is gallery ID specific and had a 1% value for the gutter which was not looking right for you.
In #2 I corrected this by changing the CSS selector to use a generic CSS selector with no ID and I updated the gutter widths to rather be a fixed 1px value instead of a percentage. To be able to use the fixed pixel value for the gutter widths I had to update the column widths to use the CSS function
calc(). So instead of the column width for 6 columns being a static 15.66% (100% / 6 columns – 1% for gutter) it performs the calculation on the fly using thecalc(16.66% - 1px)function as you can’t mix percentages and pixels statically in CSS.#3 was merely a suggestion if you didn’t want to use the Gallery Settings > Advanced > Custom Gallery Class and the
custom-colsCSS class outlined in #2. This method however has the drawback of being brittle. i.e. it will fail in one of the upcoming updates once the shorter CSS name for 5 columns is released.Personally I would use #2 as it gives you the ability to override the layout on any gallery by just adding the
custom-colsCSS class and setting the layout to one of the column options. It should be future safe as it does not use the 5 column class name which is changing. It also gives you the option to still use the original 5 column layout on one gallery and then your custom 6/7/X column layout on the next.Thanks
SteveHi @generalnumpty,
It is possible to use a fixed gutter with a percent column width however we would need to adjust the CSS to use the
calc()function. We can also get rid of the gallery ID by making the custom CSS have a selector that is more specific than the default.Try adding the following to your sites custom CSS file;
/* 6 column layout on desktop */ .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(16.66% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(16.66% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; } /* Force 5 column layout < 1280px */ @media screen and (max-width: 1280px) { .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(20% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(20% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; } } /* Force 4 column layout < 992px */ @media screen and (max-width: 992px) { .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(25% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(25% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; } } /* Force 3 column layout < 720px */ @media screen and (max-width: 720px) { .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(33.33% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(33.33% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; } } /* Force 2 column layout < 480px */ @media screen and (max-width: 480px) { .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: calc(50% - 1px); } .foogallery.fg-masonry.custom-cols .fg-column-width { width: calc(50% - 1px); } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 1px; } } /* Force 1 column layout < 320px */ @media screen and (max-width: 320px) { .foogallery.fg-masonry.custom-cols .fg-item { margin-bottom: 1px; width: 100%; } .foogallery.fg-masonry.custom-cols .fg-column-width { width: 100%; } .foogallery.fg-masonry.custom-cols .fg-gutter-width { width: 0; } }Any gallery you want to use your custom columns on you simply set the layout to any of the column layouts and then add the
custom-colsvalue to the Gallery Settings > Advanced > Custom Gallery Class option.If you don’t want to use the
custom-colsCSS class and simply want to always override the 5 column layout then change all the.custom-colsclasses in the above to.fg-masonry-5col.That said we have been working on an update which I know contains a change to the 5 column class name to
.fg-col5. This means you will need to keep an eye out for the upcoming performance update which contains this change and update your customizations accordingly.Thanks
SteveHi @generalnumpty,
After looking at what is possible I would recommend doing what you originally wanted and simply make the template have six columns.
To do this set the template to use the Masonry Layout > 5 Columns option along with the Gutter Size > Normal Size Gutter option.
You can then use the following CSS in the Custom CSS option for the gallery. You will need to replace the ID,
#foogallery-gallery-1, with your own gallery’s ID but once that is done it should result in six columns being displayed on screens wider than 1280px./* 6 column layout on desktop */ #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 15.66%; } #foogallery-gallery-1 .fg-column-width { width: 15.66%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; } /* Force 5 column layout < 1280px */ @media screen and (max-width: 1280px) { #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 19%; } #foogallery-gallery-1 .fg-column-width { width: 19%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; } } /* Force 4 column layout < 992px */ @media screen and (max-width: 992px) { #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 24%; } #foogallery-gallery-1 .fg-column-width { width: 24%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; } } /* Force 3 column layout < 720px */ @media screen and (max-width: 720px) { #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 32%; } #foogallery-gallery-1 .fg-column-width { width: 32%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; } } /* Force 2 column layout < 480px */ @media screen and (max-width: 480px) { #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 49%; } #foogallery-gallery-1 .fg-column-width { width: 49%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; } } /* Force 1 column layout < 320px */ @media screen and (max-width: 320px) { #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 100%; } #foogallery-gallery-1 .fg-column-width { width: 100%; } #foogallery-gallery-1 .fg-gutter-width { width: 0; } }You can extend this to however many columns and/or media breakpoints you like by using the following formula to calculate the column width to supply:
(100 / Column Count) - Gutter Width = Column WidthSo if I wanted to make this seven columns instead of six I could do:
(100 / 7) - 1 = 13.28(Rounded down to avoid overflowing max width)So the first part of the CSS for seven columns would look like:
/* 7 column layout on desktop */ #foogallery-gallery-1 .fg-item { margin-bottom: 1%; width: 13.28%; } #foogallery-gallery-1 .fg-column-width { width: 13.28%; } #foogallery-gallery-1 .fg-gutter-width { width: 1%; }Thanks
Steve- This reply was modified 5 years, 5 months ago by steveush. Reason: Fixed formatting
Hi @rick0316,
Ok I see the issue. In the article the link is just a text link, so when it is clicked the
e.targetis pointing to the anchor element and thee.target.hashis effectively the gallery ID. In your case you have aimginside the anchor that is being clicked. In the listener thee.targetis theimgelement and soe.target.hashdoes not exist which causes the lightbox to never be displayed.There are a couple of ways to fix this:
1. Change the JS snippet to not use the event object to get the element. i.e. Change
e.target.hashtothis.hash. e.g.jQuery(function($){ $(".hidden-gallery-link").on("click", function(e){ e.preventDefault(); $( this.hash ).find(".fg-thumb:first").click(); }); });or…
2. Make the child elements (the images) within the links non-clickable using some CSS. e.g.
.hidden-gallery-link * { pointer-events; none; }Thanks
SteveHi @rick0316,
Unfortunately the way you have setup the links is not the recommended way to open a hidden gallery. Please take a look at the documentation provided here: https://fooplugins.com/documentation/foobox/developers-foobox/open-galleries-in-lightbox-from-text-link/
The way you’re currently opening links relies on chance a bit, which is why sometimes they work and sometimes they don’t. FooBox is picking up the links however that link is a duplicate of one of the items in the gallery and FooBox removes duplicates. So what’s happening here is on one page your link is working as FooBox removed the duplicate from the gallery itself while on the other page it removed the link duplicate.
Thanks
SteveHi @kooba,
Yes it might, the higher the quality, the larger the thumbnail size. The default of 80% gives a decent reduction in size without too much of a loss in quality.
That said it all depends on your use case, the best thing is to simply test for yourself and use what’s best for you.
Thanks
SteveHi @kooba,
There should be an option in the main FooGallery > Settings section to change the thumbnail quality. I believe it is 80% by default.
Thanks
SteveHi @kooba,
1. Original issue regarding justified;
So far from my testing the issue is indeed with the last row option. I do see differences when changing the option locally. I can achieve your desired result on mobile by setting it to justify the last row however this can have undesired results on desktop.
Essentially you are wanting the gallery to justify the last row, but only on mobile, then on desktop apply your chosen value of “center”.
Unfortunately I can’t give you an easy way to do this now as the layout for the justified template is all done through JS. We are busy at the moment with a performance rewrite but I think I could squeeze this change in as well for the next release.
2. Blurry images;
Could you clarify what you mean by they get nice and sharp only after displaying in a lightbox?
The thumbnails displayed in the gallery itself should not change by opening the full size image in a lightbox. They are completely different images created from the large full size image. They have a reduced size and quality compared to the full size image as they are scaled down and cropped to the thumbnail size specified in the template settings.
Thanks
Steve