Jump to content

How to hide the 'previous' gallery slide image in mobile view

Go to solution Solved by Web_Solutions,

Recommended Posts

Posted

Hi,

I've changed the displayed image ratio of my shop's gallery slide image using the following CSS code:

 

/* product images */
img.pdp-gallery-slides-image {
   object-fit: contain !important;
}

 

When images have different ratios, I can see the 'previous' images behind/below the currently displayed image as seen in the image attached. Is there a way to prevent this from happening?

OR:

Would it be possible to automatically adjust the wrapper's/container's height to the height of the current slide image, no matter the ratio? 

 

password for site access: hello@yumi72

 

Thanks in advance!

Screenshot 2023-11-28 at 10.20.08.JPG

Posted
1 hour ago, Flotzi said:

Hi,

I've changed the displayed image ratio of my shop's gallery slide image using the following CSS code:

 

/* product images */
img.pdp-gallery-slides-image {
   object-fit: contain !important;
}

 

When images have different ratios, I can see the 'previous' images behind/below the currently displayed image as seen in the image attached. Is there a way to prevent this from happening?

OR:

Would it be possible to automatically adjust the wrapper's/container's height to the height of the current slide image, no matter the ratio? 

 

password for site access: hello@yumi72

 

Thanks in advance!

Screenshot 2023-11-28 at 10.20.08.JPG

Can you share your website URL?

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

Posted
5 hours ago, Flotzi said:

of course:

https://www.yumiweaves.com/shop/p/dolores

password for site access: hello@yumi72

I can't see the gallery slide

Screenshot_439.png

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

  • Solution
Posted
8 hours ago, Flotzi said:

The format is set to "wrap". So the slide only appears in mobile view or if you make your browser window really narrow.

Add these code on Custom CSS panel in Website Utilities Website Tools > Custom CSS.

@media screen and (max-width: 767px) {
    .view-item .pdp-gallery .pdp-gallery-slides img{
        object-position: center !important;
        object-fit: contain !important;
        visibility: hidden;
    }
    .view-item .pdp-gallery .pdp-gallery-slides.selected img{
        visibility: visible !important;
    }
}

 

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

Posted

this is working perfectly! thank you so much! 💥

 

alternatively, would it be possible to keep the "object-fill" at "cover" and increase the height of the "container'/gallery? at the moment the gallery's resolution is 1:1. Is there a way to change that, maybe to 3:2 ?

 

Posted
6 hours ago, Flotzi said:

this is working perfectly! thank you so much! 💥

 

alternatively, would it be possible to keep the "object-fill" at "cover" and increase the height of the "container'/gallery? at the moment the gallery's resolution is 1:1. Is there a way to change that, maybe to 3:2 ?

 

Replace the pervious code with the code bellow. 

@media screen and (max-width: 767px) {
    .pdp-layout .pdp-gallery-images::before {
        padding-bottom: 130% !important;
    }
    .view-item .pdp-gallery .pdp-gallery-slides img {
        object-position:top !important;
        object-fit: contain !important;
        visibility: hidden
    }
    .view-item .pdp-gallery .pdp-gallery-slides.selected img {
        visibility: visible !important
    }
}

 

If my comments are useful, please like and mark my solution as answer. It will encourage me. Thanks

MD Rofik
Website Designer and Digital Marketer

Am I helpful? Want to offer me a coffee?
Send me a message if needed any help. I'll try to reply as soon as possible.


 

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.