What's your biggest current challenge? Have your say in Community Polls along the right column.

Slide Show Mobile Gallery - Make automatic rotation optional [Showcase theme]

Slide Show Mobile Gallery - Make automatic rotation optional [Showcase theme]

lenarei
Explorer
52 3 4

Based on this post on the community about creating an automatic slide show gallery on mobile, I am wondering how to make the autoplay function a selectable option. I tried to manipulate the code as follows, but haven't been able to make it work:

 

in gallery.liquid I added:

{% if section.settings.enable_carousel %} gallery--mobile-carousel slick-slider-overlay-dots data-autoplay="{{ section.settings.autoplay }}" data-autoplay-speed="{{ section.settings.autoplay_speed }}"{% endif %}

 

and in schema:

{
"id": "autoplay",
"type": "checkbox",
"label": "Auto-rotate slides",
"default": false
},
{
"type": "range",
"id": "autoplay_speed",
"min": 1,
"max": 20,
"step": 1,
"unit": "s",
"label": "Change slides every",
"default": 7
}

 

Then I added the following in theme.js:

$carouselGallery.on('init', function () {
$('.lazyload--manual', this).removeClass('lazyload--manual').addClass('lazyload');
}).slick({
autoplay: $(this).data('autoplay'),
fade: false,
speed: 600,
autoplaySpeed: autoplaySpeed,
infinite: true, ...

 

Which part am I missing?

lenarei_0-1662287648970.png

 

https://semu1lktjsng69ep-60850798810.shopifypreview.com

 

@LitExtension 

 

Replies 2 (2)

LitExtension
Shopify Partner
4879 1003 1169

Hi @lenarei,

Sorry for the delay, I checked and it works fine, did you solve it?

LitExtension - Shopping Cart Migration Expert
Check out our Shopify migration app to migrate your online store to Shopify
lenarei
Explorer
52 3 4

Hi @LitExtension

Thanks for your answer. I got the gallery to auto-rotate on mobile, but now this is the only option, I cannot set it up so that the user will have to slide manually. I would like to be able to turn the auto-rotate on/off depending on where I use the section on my website.

 

lenarei_0-1662363138592.png

 

This is what I added in gallery.liquid via schema and is visible on the front-end. But it doesn't change back to manual rotation when I uncheck the option here.