gpt4 book ai didi

php - 在woocommerce 3中调整产品图像的缩放倍率

转载 作者:行者123 更新时间:2023-12-04 09:42:00 25 4
gpt4 key购买 nike

我正在使用 Storefront 主题,并且一直想知道是否有办法调整悬停在产品图像上的缩放级别。

最佳答案

这可以使用 woocommerce_single_product_zoom_options专用过滤钩。

The hook undocumented available parameters in the options array are:


$zoom_options = array (
    'url' => false,
'callback' => false,
'target' => false,
'duration' => 120, // Transition in milli seconds (default is 120)
'on' => 'mouseover', // other options: grab, click, toggle (default is mouseover)
'touch' => true, // enables a touch fallback
'onZoomIn' => false,
'onZoomOut' => false,
'magnify' => 1, // Zoom magnification: (default is 1 | float number between 0 and 1)
);
相关: Available parameters details for WooCommerce product image zoom options
与 woocommerce_single_product_zoom_options 过滤钩一起使用 更改放大级别 (例如,我们将缩放级别最小化一点):
add_filter( 'woocommerce_single_product_zoom_options', 'custom_single_product_zoom_options' );
function custom_single_product_zoom_options( $zoom_options ) {
// Changing the magnification level:
$zoom_options['magnify'] = 0.7;

return $zoom_options;
}
代码位于事件子主题(或事件主题)的 functions.php 文件中。测试和工作。
之前使用默认放大倍数(设置为 1 ):
enter image description here
之前放大倍数设置为 0.7 :
enter image description here

关于php - 在woocommerce 3中调整产品图像的缩放倍率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53584936/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com