Skip to content

Commit

Permalink
Merge pull request woocommerce#18208 from MannyC/master
Browse files Browse the repository at this point in the history
Allow back end to pass adhoc options to the product flexslider
  • Loading branch information
claudiulodro committed Dec 20, 2017
2 parents 3877c82 + 1252215 commit 6766ba2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions assets/js/frontend/single-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

$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() {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/single-product.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6766ba2

Please sign in to comment.