BrianBlair Posted May 28 Posted May 28 In the Lightbox, I'm looking to display captions on the right side underneath the image. I also don't want the captions to show on the mosaic gallery, just on the right side. Can someone help me with this? Beyondspace 1
Beyondspace Posted May 29 Posted May 29 18 hours ago, BrianBlair said: In the Lightbox, I'm looking to display captions on the right side underneath the image. I also don't want the captions to show on the mosaic gallery, just on the right side. Can someone help me with this? Can you share your URL with link to this gallery? BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
BrianBlair Posted May 29 Author Posted May 29 https://www.brianblairvisuals.com/test @Beyondspace Thank you
Beyondspace Posted May 29 Posted May 29 It requires to combine js code and CSS code to implement this feature. Do you have business plan or above one? BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
BrianBlair Posted May 29 Author Posted May 29 @Beyondspace I have a business plan. I can do CSS code and JS code.
Beyondspace Posted May 30 Posted May 30 (edited) You can try the following code on footer injection: <script> document.addEventListener('DOMContentLoaded', function () { const itemGallery = document.querySelectorAll('.gallery-masonry-item'); var itemGalleryLightBox = document.querySelectorAll('.gallery-lightbox-item'); var countGalleryItem = itemGallery.length; itemGallery.forEach((item, i) => { const link = item.querySelector('.gallery-masonry-lightbox-link'); const itemP = item.querySelector('p'); if (link && itemP) { const caption = itemP.cloneNode(true); const id = link.getAttribute('href').replace('?itemId=',''); const itemNeedCaption = Array.from(itemGalleryLightBox).find(lightboxItem => { return lightboxItem.getAttribute('data-slide-url') === id; }); itemNeedCaption.appendChild(caption); } }) }) </script> <style> .gallery-lightbox-outer-wrapper .gallery-lightbox-item:last-child .gallery-caption-content { transition: none !important; opacity: 1 !important; } .gallery-lightbox-outer-wrapper .gallery-lightbox-item .gallery-caption-content { transition: none !important; opacity: 0 !important; } </style> My demo Let me know how it works on your site Edited June 4 by Beyondspace BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
BrianBlair Posted May 30 Author Posted May 30 (edited) 6 hours ago, Beyondspace said: You can try the following code on footer injection: <script> document.addEventListener('DOMContentLoaded', function () { const itemGallery = document.querySelectorAll('.gallery-masonry-item'); var itemGalleryLightBox = document.querySelectorAll('.gallery-lightbox-item'); var countGalleryItem = itemGallery.length; itemGallery.forEach((item, i) => { const link = item.querySelector('.gallery-masonry-lightbox-link'); const caption = item.querySelector('p').cloneNode(true); if (link && caption) { const id = link.getAttribute('href').replace('?itemId=',''); console.log (id); const itemNeedCaption = Array.from(itemGalleryLightBox).find(lightboxItem => { return lightboxItem.getAttribute('data-slide-url') === id; }); itemNeedCaption.appendChild(caption); } }) }) </script> <style> .gallery-lightbox-outer-wrapper .gallery-lightbox-item:last-child .gallery-caption-content { transition: none !important; opacity: 1 !important; } .gallery-lightbox-outer-wrapper .gallery-lightbox-item .gallery-caption-content { transition: none !important; opacity: 0 !important; } </style> My demo Let me know how it works on your site Thank you so much for the code on this. I also added the following in the <style> section to hide the captions on the mosaic gallery and change the font to something custom. figcaption.gallery-caption { display:none; } .gallery-lightbox-item { color:black; font-family: 'American Typewriter', serif; } The only thing that seems to be happening is that the copy is overlapping on Safari browsers on my client's side. Edited May 30 by BrianBlair
BrianBlair Posted May 31 Author Posted May 31 (edited) @Beyondspace For some reason the captions aren't showing up on all of the images. Could it be an issue with the number of characters? Should it maybe go to two lines in this case? This is the current code I have in Custom CSS .header-announcement-bar-wrapper { padding-top:0px !important; padding-bottom:0px !important; } /* Change the background color - gallery*/ .gallery-lightbox-background{ background: #ffffff; opacity:1 } /* Change the close button color - gallery */ .gallery-lightbox-close-btn-icon * {color: #000000; } /* Change the prev/next controls - gallery */ .gallery-lightbox-control-btn-icon *{ color: #000000; } /* - - Simple Slideshow - - */ @media only screen and (max-width:2560px) { .gallery-slideshow-item-wrapper, .gallery-slideshow-item img{ width: 100vw!important; object-fit: cover; left: 0!important } } This is the code in the Code Injection <script> document.addEventListener('DOMContentLoaded', function () { const itemGallery = document.querySelectorAll('.gallery-masonry-item'); var itemGalleryLightBox = document.querySelectorAll('.gallery-lightbox-item'); var countGalleryItem = itemGallery.length; itemGallery.forEach((item, i) => { const link = item.querySelector('.gallery-masonry-lightbox-link'); const caption = item.querySelector('p').cloneNode(true); if (link && caption) { const id = link.getAttribute('href').replace('?itemId=',''); console.log (id); const itemNeedCaption = Array.from(itemGalleryLightBox).find(lightboxItem => { return lightboxItem.getAttribute('data-slide-url') === id; }); itemNeedCaption.appendChild(caption); } }) }) </script> <style> .gallery-lightbox-outer-wrapper .gallery-lightbox-item:last-child .gallery-caption-content { transition: none !important; opacity: 1 !important; } .gallery-lightbox-outer-wrapper .gallery-lightbox-item .gallery-caption-content { transition: none !important; opacity: 0 !important; } figcaption.gallery-caption { display:none; } .gallery-lightbox-item { color:black; font-family: 'American Typewriter', serif; } </style> Thanks, Edited May 31 by BrianBlair
Beyondspace Posted June 4 Posted June 4 I check that it works normally (show caption on all images). Which one are you referring? BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
BrianBlair Posted June 4 Author Posted June 4 (edited) @Beyondspace https://www.brianblairvisuals.com/gallery-5-2 For example on this page, captions will show up in the lightbox for the first 19 images, but after that, they won't show up. This is one example, but this occurs on the majority of gallery pages. Thanks, Garrett Edited June 4 by BrianBlair
Beyondspace Posted June 4 Posted June 4 Try the new js code <script> document.addEventListener('DOMContentLoaded', function () { const itemGallery = document.querySelectorAll('.gallery-masonry-item'); const itemGalleryLightBox = document.querySelectorAll('.gallery-lightbox-item'); itemGallery.forEach((item, i) => { const link = item.querySelector('.gallery-masonry-lightbox-link'); const itemP = item.querySelector('p'); if (link && itemP) { const caption = itemP.cloneNode(true); const id = link.getAttribute('href').replace('?itemId=',''); const itemNeedCaption = Array.from(itemGalleryLightBox).find(lightboxItem => { return lightboxItem.getAttribute('data-slide-url') === id; }); itemNeedCaption.appendChild(caption); } }) }) </script> BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
BrianBlair Posted June 4 Author Posted June 4 Thank you so much @Beyondspace The only thing I'm running into is the transitions overlaying one another for about a second. This is only happening in Safari for some reason. See attached.
tuanphan Posted June 7 Posted June 7 @BrianBlair You try this to Website Tools > Custom CSS to fix problem div.gallery-lightbox-list p.gallery-caption-content { background-color: white; } Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment