Jump to content

Adding descriptions to carrousel

Go to solution Solved by Beyondspace,

Recommended Posts

I need to add descriptions to a gallery carousel without having it visible on the main gallery. Is there any way to tweak the code to exclude descriptions on the main gallery? So far, I've only found additional code which adds a description in both places:

 

<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,\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>

Link to comment
  • Solution

I made a slightly changes, please check if it work

<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>

 

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
13 hours ago, F-RAVN said:

Amazing, it works! Thank you!! 🙏

Now the only slight issue is the 'echo' when flipping through the carousel. I've attached a screen recording. Any chance you know how to fix that?

I’m not to sure since I’m not a pro at coding, but I would check the codes if I were you, to see if there’s something messing up with the transition.

Link to comment

Hi I really am desperate for help on this issue.

On pc the website looks fabulous, exactly the way I wanted it to be. 
Problem comes up on mobile. 
www.ibisette.com/portfolio/portraits for example, all portrait-oriended photo's in the carousel show a lot of blank space on both left and right side of the image as you can see on the screenshot below. 

vzH0YU1YtiP_kqxaLVXge-652-kL0KPsN-NCbH99v4uRpBFMIPND-7OLMccD90wxXR8w2Wo2D8lcs6C8lo72KqAWVJwjbWS_dEnZleE2e2LpFejBh1Eq7paBWQOQW2N25X4KM7G5GESvnEoRQlKUoO7qTgFjQyTZyCvAkF_VFxY8i3H3JHsd37SNFJXLUEChUg5bMaJsc-9w7ctMpK4mjcNdg8aZ9yfIIFVWEpzIIgf0RzhnLol-SIyp-TWSK38j71ew3cmbI18mDt353zRY_ITNsCb4DZvjZ9CE83lM04-ObileTbPpq41YCfXf9KP-YUemSYsjV2oNkUhOcUdde3gEFioyCYJ0YaE_I2i0HurT1go1HHvufR86QiR65GiphcI4YiV3dw9bR2liVf5rg4YuXdISpjTbpGGGKu9vGoOY8tMeBAWTBGMgGpORodH0M19iVvQuHcDANAAZNhaKRF4OWXNQ8DlyhXIQ7JALyCnwb3gHZJEQ7osS21Kf8G6I5nykP81beSf3peZpiW850uWXTkBs2zUg0Q521HQudZIDS5_S7mPSWhoiXkynQ38I-KBfSSN3dYod1_H8bBHQNPjCwW4wbp7zFZxBdBcbOUFiyN3u-oycM0iv9Dqj7T6gXkslqzgWD9lcPXBmG2pd0aHLrH7fiWIP2xWsQup8fn64MeK4cljIHmRx_sJk6vg=w968-h1988-no?authuser=0


I would like to have the carousel to be taller so that pictures in both landscape and portrait mode be seen clearly. (I have absolutely no problem with how the landscape mode pictures are displayed now, it's great. It's just for the portrait mode that the blank space is way too big. I would love it to look a little more like the paint job I did below: 

image.thumb.png.20ea10287c661d95bd53987a97bee3fb.png
Is there anyone who could help me write a little bit of code to fix this issue? 
I have disabled the autoplay.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.