admin管理员组

文章数量:1415460

I am using Flexslider settings in Woocommerce to modify the image slider on the single product page. / Support for this is added into Woocommerce by default.

I have entered the below code into my functions.php in order to set 'touch' to true and enable finger swiping on touch devices. I have confirmed that this works on a mobile device. However this doesnt work on my Surface Pro 3 (also a touch device). It works only when in Chrome DevTools, if I press the device size toggle and then press refresh. However when I close DevTools and refresh again, it stops working.

add_filter("woocommerce_single_product_carousel_options", "change_flexslider_options", 10);
function change_flexslider_options($options) {
$options = array(
  'rtl' => is_rtl(), 
  'animation' => 'slide', 
  'smoothHeight' => false, 
  'directionNav' => true,  
  'controlNav' => true,
  'slideshow' => false, 
  'animationSpeed' => 500, 
  'animationLoop' => false,
  'touch' => true,
);
return $options;
}

I am not sure how to have flexslider recognise whether the desktop is or isnt a touch device.

本文标签: jqueryWoocommerce Flexslider touch functionality on desktop not working