如何将不同尺寸的图像适合“框”在WooCommerce中,单产品页面图像滑块
我偶然发现了WooCommerce单产品页面图像尺寸的一个问题。 产品图像的尺寸不是相同的,这就是为什么其中一些作物的原因。
我添加了此CSS试图解决此问题:
.woocommerce.single-product #content div.product div.images, .woocommerce.single-product div.product div.images, .woocommerce-page.single-product #content div.product div.images, .woocommerce-page.single-product div.product div.images {
min-height: 500px;
min-width: 650px;
max-height: 500px;
max-width: 650px;
}
div.woocommerce-product-gallery__image.flex-active-slide{
height: 400px;
object-fit: cover;
}
它将照片滑块的位置和大小放置在我想要的位置,但是当我浏览照片时,一些照片会裁剪。我需要所有的照片才能适应高度(400px)。应自动设置宽度,以使图像在400px高度下完全可见。也许有人知道该怎么做?
使用WordPress + Elementor + ShopTimizer主题
非常感谢!
I stumbled upon one problem with WooCommerce single product page image sizes.
Product images are not the same size, that's why some of them crops.
I added this css trying to fix this:
.woocommerce.single-product #content div.product div.images, .woocommerce.single-product div.product div.images, .woocommerce-page.single-product #content div.product div.images, .woocommerce-page.single-product div.product div.images {
min-height: 500px;
min-width: 650px;
max-height: 500px;
max-width: 650px;
}
div.woocommerce-product-gallery__image.flex-active-slide{
height: 400px;
object-fit: cover;
}
It puts the location and size of the photos slider and the active photo where I want them to be, but when I go through the photos, some of the photos get cropped. I need all the photos to fit to height (400px). The width should be automatically set so that the image is fully visible at 400px height. Maybe someone knows how to do it?
Using WordPress + Elementor + Shoptimizer theme
Link to single product page: https://bonideco.com/product/lawa-design-modernus-laikrodis-delta-azuolo-spalvos-su-juodomis-rodyklemis/
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过数小时的研究,我终于找到了满足我需求的代码。
After many hours of research I finally found the code that meet my needs.
输入自定义CSS:
Enter in custom CSS: