Skip to content

Instantly share code, notes, and snippets.

@MogulChris
Created November 3, 2022 01:05
Show Gist options
  • Save MogulChris/e1198365d152ff485e53dab42ae52592 to your computer and use it in GitHub Desktop.
Save MogulChris/e1198365d152ff485e53dab42ae52592 to your computer and use it in GitHub Desktop.
Adjusting the JupiterX WooComemrce Product Gallery thumbnails
<?php
//change the image size used in thumbnails
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return array(
'width' => 300,
'height' => 200,
'crop' => 1,
);
});
?>
/*
- Remove max width on the thumbnail slider
- allow the thumbnail images to be as large as you need
*/
body.woocommerce div.product div.woocommerce-product-gallery .flex-control-thumbs { max-width:100% !important;}
body.woocommerce div.product div.woocommerce-product-gallery .flex-control-thumbs li {max-width: 300px !important;}
jQuery(document).ready(function($) {
//Update the number of slides to show in the thumbnail slider (slick.js)
$('body').on('init','.flex-control-nav', function(){
setTimeout(function(){ //should work without this but I am out of time
//This is the important line, but you need to run it after Slick has fully initialised.
//Unfortunately JupiterX will add most of HTML dynamically for the slider, so you can't just wait for $('.flex-control-nav') to init
//4 = number of thumbnails you want
$('.flex-control-nav').slick('slickSetOption', 'slidesToShow', 4);
},500);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment