问题
Has anyone been able to add navigation arrows for Next/Prev slides in the new woocommerce slider?
The thumbnail navigation particularly on mobile/table is great, but having arrows as well for desktop users would be a dream! Arrows on the main product image are preferred over the lightbox. You will understand why on our site: http://52.56.199.58/collection/bedroom/giorgetti-syn-bedside-table/
Would seem an easy and obvious option that Woocommerce has forgotten. Any help or guidance would be much appreciated.
Cheers
回答1:
You can update the Flexslider options in WooCommerce V3 by hooking into the 'woocommerce_single_product_carousel_options'
filter. So specifically to enable the navigation arrows the 'directionNav' option should be set to 'true'.
Put this example function in your functions.php file and you should be good to go:
// Update WooCommerce Flexslider options
add_filter( 'woocommerce_single_product_carousel_options', 'ud_update_woo_flexslider_options' );
function ud_update_woo_flexslider_options( $options ) {
$options['directionNav'] = true;
return $options;
}
回答2:
ul.flex-direction-nav {
position: absolute;
top: 30%;
z-index: 99999;
width: 100%;
left: 0;
margin: 0;
padding: 0px;
list-style: none;}
li.flex-nav-prev {float: left;}
li.flex-nav-next {float: right;}
a.flex-next {visibility:hidden;}
a.flex-prev {visibility:hidden;}
a.flex-next::after {visibility:visible;content: '\f105';
font-family: FontAwesome;margin-right: 10px;font-size: 70px; }
a.flex-prev::before {
visibility:visible;
content: '\f104';
font-family: FontAwesome; margin-left: 10px;font-size: 70px;}
回答3:
Some more tested value with woocommerce 3.5.3
add_filter('woocommerce_single_product_carousel_options', 'ud_update_woo_flexslider_options');
function ud_update_woo_flexslider_options($options) {
// show arrows
$options['directionNav'] = true;
$options['animation'] = "slide";
// infinite loop
$options['animationLoop'] = true;
// autoplay (work with only slideshow too)
$options['slideshow'] = true;
//$options['autoplay'] = true;
// control par texte (boolean) ou bien par vignettes
// $options['controlNav'] = true;
//$options['controlNav'] = "thumbnails";
// $options['mousewheel'] = true;
return $options;
}
来源:https://stackoverflow.com/questions/46353307/navigation-arrows-in-woocommerce-3-x-product-gallery-slider