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?

