Allow back end to pass adhoc options to the product flexslider, following the standard set by the photoswipe options.
This commit also changes the name of the options array key from `flexslider` to `flexslider-options`, also following the photoswipe standard. As a side effect, the flexslider is now correctly being passed the `rtl` parameter, which previously wasn't being used by the front end (even though the back end was sending it).
This commit is contained in:
parent
906efe1ffc
commit
c8dfc7e91e
|
@ -138,23 +138,17 @@ jQuery( function( $ ) {
|
|||
var $target = this.$target,
|
||||
gallery = this;
|
||||
|
||||
$target.flexslider( {
|
||||
selector: '.woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image',
|
||||
animation: wc_single_product_params.flexslider.animation,
|
||||
smoothHeight: wc_single_product_params.flexslider.smoothHeight,
|
||||
directionNav: wc_single_product_params.flexslider.directionNav,
|
||||
controlNav: wc_single_product_params.flexslider.controlNav,
|
||||
slideshow: wc_single_product_params.flexslider.slideshow,
|
||||
animationSpeed: wc_single_product_params.flexslider.animationSpeed,
|
||||
animationLoop: wc_single_product_params.flexslider.animationLoop, // Breaks photoswipe pagination if true.
|
||||
allowOneSlide: wc_single_product_params.flexslider.allowOneSlide,
|
||||
var options = $.extend( {
|
||||
selector: '.woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image',
|
||||
start: function() {
|
||||
$target.css( 'opacity', 1 );
|
||||
},
|
||||
after: function( slider ) {
|
||||
gallery.initZoomForTarget( gallery.$images.eq( slider.currentSlide ) );
|
||||
}
|
||||
} );
|
||||
}, wc_single_product_params.flexslider_options );
|
||||
|
||||
$target.flexslider( options );
|
||||
|
||||
// Trigger resize after main image loads to ensure correct gallery size.
|
||||
$( '.woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image' ).one( 'load', function() {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -458,7 +458,7 @@ class WC_Frontend_Scripts {
|
|||
$params = array(
|
||||
'i18n_required_rating_text' => esc_attr__( 'Please select a rating', 'woocommerce' ),
|
||||
'review_rating_required' => get_option( 'woocommerce_review_rating_required' ),
|
||||
'flexslider' => apply_filters( 'woocommerce_single_product_carousel_options', array(
|
||||
'flexslider_options' => apply_filters( 'woocommerce_single_product_carousel_options', array(
|
||||
'rtl' => is_rtl(),
|
||||
'animation' => 'slide',
|
||||
'smoothHeight' => true,
|
||||
|
|
Loading…
Reference in New Issue