Change owl carousel number of slides shown on mobile
-
Hi,
Right now on our website, we have a category carousel slide on the homepage. It looks great on desktop, however, on mobile it automatically shows 2 items. Is it possible to make it only show 1?
Thanks,
Tim
Hello,
You can change this in the Theme Settings > Shop. Please find Products columns on the mobile option it is effective for Product categories.
Best Regards
Hi, thanks for the reply.
Unfortunately, that fix won’t work as we quite like having 2 columns of products. Is there a way to just change the categories in a carousel?
Thanks,
Tim
Try to add the following PHP code snippet to the child theme functions.php file to do this
function basel_get_owl_items_numbers( $slides_per_view, $post_type = false, $custom_sizes = false ) {
$items = array();
$items['desktop'] = ( $slides_per_view > 0 ) ? $slides_per_view : 1;
$items['desktop_small'] = ( $items['desktop'] > 1 ) ? $items['desktop'] - 1 : 1;
if ( $items['desktop'] == 6 ) $items['desktop_small'] = 4;
$items['tablet'] = ( $items['desktop_small'] > 1 ) ? $items['desktop_small'] : 1;
$items['mobile'] = 1;
if ( $post_type == 'product' ) {
$items['mobile'] = basel_get_opt( 'products_columns_mobile' );
}
if ( $custom_sizes ) {
return $custom_sizes;
}
return $items;
}