最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Woocommerce Flexslider touch functionality on desktop not working

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论