Jump to content

Make product image carousel crop from centre as it scales down

Go to solution Solved by SaranyaDesigns,

Recommended Posts

I'm trying to make the product carousel crop from the center once the page is below 1360px wide. I have it pretty much working, but can only get it so the images are cropped from the right edge inward.

Code is presently set as:

/*Product Gallery Responsive Fit Adjustment*/

 @media screen and (min-width:1360px) {.ProductItem-gallery-slides img {
    height: auto !important;
    width: 50vw !important;
    overflow-x: hidden !important;
  }
.ProductItem-gallery div {
    height: auto !important;
   }}

 @media screen and (max-width:1359px) and (min-width:767px) {
.ProductItem-gallery-slides img {
    min-height: 480px !important;
    width: auto !important;
    overflow-y: hidden !important;
  }
   .ProductItem-gallery div {
    min-height: 480px !important;
    width: 50vw !important;
   }
.ProductItem-summary {
  min-height: 480px !important;
   } 
   .product-item-gallery-carousel-control {
     margin-top: 225px !important;     
   }}

Thanks in advance for any help offered.

Edited by rocketbase
Link to comment
  • rocketbase changed the title to Make product image carousel crop from centre as it scales down
  • Solution

@rocketbase ok start by removing all of your current code for (max-width:1359px) and (min-width:767px). And try replacing with this:

@media screen and (max-width:1359px) and (min-width:767px) {
	.ProductItem .ProductItem-summary {
		align-items: stretch !important;
	}
	.ProductItem-gallery {
		float: none !important;
	}
	.ProductItem-gallery-slides {
		height: 100%;
	}
	.ProductItem-gallery-slides img {
		object-fit: cover !important;
	}
}

Let me know?

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.