F-RAVN Posted November 19, 2020 Share Posted November 19, 2020 I've adapted a gallery page with the following code, to display the descriptions. However, there's a slight echo when flipping through the images (see attached video). Anyone who would know how to fix this? <script> /** * Add descriptions/captions to galleries in Squarespace 7.1. * JavaScript * © @brandon (Squarespace Forum User) * This software is provided "as is", without warranty of any kind, express or implied. */ document.addEventListener("DOMContentLoaded", function() { addGalleryItemDescriptions(); function addGalleryItemDescriptions(gs, gdzs) { var a=['querySelectorAll','section.gallery-section-exclude,\x20.gallery-lightbox','length','[class*=\x27-item\x27]:not([class*=\x27item-\x27])','getElementsByTagName','img','alt','trim','createElement','div','className','gallery-item-description','textContent','appendChild'];var b=function(c,d){c=c-0x0;var e=a[c];return e;};(function(c,d){var e,f,g,h,i,j,k;e=document[b('0x0')](c?c:b('0x1'));i=e[b('0x2')];while(i--){f=e[i][b('0x0')](d?d:b('0x3'));j=f[b('0x2')];while(j--){g=f[j][b('0x4')](b('0x5'))[0x0][b('0x6')][b('0x7')]();if(g){h=document[b('0x8')](b('0x9'));h[b('0xa')]=b('0xb');h[b('0xc')]=g;f[j][b('0xd')](h);}}}}(gs,gdzs)); } }); </script> Screen Recording – description echo.mov Link to comment
tuanphan Posted November 20, 2020 Share Posted November 20, 2020 Hi. The gallery section supported description, no need to use code. You can edit gallery section > enable caption. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
F-RAVN Posted November 20, 2020 Author Share Posted November 20, 2020 Unfortunately, it doesn't work in the lightbox. I prefer the captions not to be displayed in the gallery, and only when opened in the carousel. The descriptions are there now, but the 'echo' is causing problems. Any chance you know how to fix it? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment