Splide carousel- is it possible to store unique ids for the splide.go() command?

I’m using splide to build image carousels and have set it up so it generates a new splide each time a new image carousel module is used. I’ve successfully set it up to allow mutliple modules and splides on the same page but where I’m having trouble is using the splide.go() command to move the carousel to specific images after clicking buttons/tabs that correspond to images within the carousel.

the info on splide.go() is here: https://splidejs.com/components/controller/

What I’m not sure of or would like help with is whether I can use unique variable names for splide.go() or if it’s limited to only the variable “splide”. For example, can I have splide1.go(), splide2.go() to correspond to each subsequent carousel. If not, I’ll need a way to figure out how to uniquely change the image position for each unique carousel, not all at once.

From what I’ve tested splide(i) or different variables doesn’t seem to work how I want.

I had a similar question before but didn’t receive any replies: Multiple splide carousels- how can I store each carousel in a forLoop as a separate variable so I can use splide.go() to advance slides?

Since then I’ve used a for loop to generate new splide carousels so I can have multiple per page, but it doesn’t seem to let me use unique variables for the splide.go() functionality to move the slides forward or back depending on which tab is clicked.

Using code below. It uses Hubspot Hubl so I’m not sure if it will work as it should be hopefully it shows what I’m talking about

$(document).ready(function(){

    var splides = document.querySelectorAll('.splide');
    // 1. query slider elements: are there any splide elements?
    if(splides.length){
        // 2. process all instances
        for(var i=0; i<splides.length; i++){
            var splideElement = splides[i];
    
  var splideDefaultOptions = {
    pagination: false,
    autoplay: false,
    arrows: true,
        navigation:false,
    type: 'loop',
    perPage: 1,
  } 
    var splide = new Splide( splideElement, splideDefaultOptions ); 
        // 3. mount/initialize this slider
        splide.mount();
            
                  $('.features-top-tab .button-primary-2').click(function() {
      let id = $(this).data('id');
            splide.go(id-1);  
  });
        }
    }
.features-image-carousel-container-2  .features-carousel {
    padding-top:80px;
    padding-bottom:100px;
}

.features-image-carousel-container-2  .features-carousel  .splide {
    max-width:676px;
}
    .features-image-carousel-container-2  .features-carousel  .splide img {
max-width: 674px ! Important;
    max-height: 440px ! Important;
    object-fit: cover;
    border-radius: 15px;
box-shadow: 0px 4px 44px 0px rgba(89, 89, 89, 0.30);
}
.splide .splide__arrow--next,  .splide .splide__arrow--prev {
    border-radius: 50px;
     width:48px;
     height:48px;
    background-color: var(--Primary-Colors-Contract-Safe-Blue, #0D4EB5);
}

.features-image-carousel-container-2 .splide__slide img {
width:100%;
}


.splide .splide__arrow--next {
    right:-5rem;
}

.splide .splide__arrow--prev {
    left:-5rem;
}
    <div class="features-carousel-wrapper">
            <div class="carousel-title">
                <h2> carousel title </h2>
            </div>
            <div class="features-top-tab-row">
                {% for item in module.top_carousel_tab %}
                <div class="features-top-tab">
                <div data-id="{{loop.index}}" class="button-primary-2">
                        {% inline_text field="top_carousel_tab_text" value="{{ item.top_carousel_tab_text }}" %}
                        </div>
                </div>
    
                {% endfor %}
            </div>
            <div class="features-carousel">
                 <section class="splide" aria-label="Splide Basic HTML Example">
                     <div class="splide__arrows">
                         <button class="splide__arrow splide__arrow--prev">
                         </button>
                         <button class="splide__arrow splide__arrow--next">
                         </button>
                     </div>

            <div class="splide__track">
              <ul class="splide__list">
                {% for item in module.carousel_image_two %}
                <li class="splide__slide">      
                                    {% if item.src %}
                                    {% set sizeAttrs = 'width="{{ item.width|escape_attr }}" height="{{ item.height|escape_attr }}"' %}
                                    {% if item.size_type == 'auto' %}
                                    {% set sizeAttrs = 'width="{{ item.width|escape_attr }}" height="{{ item.height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
                                    {% elif item.size_type == 'auto_custom_max' %}
                                    {% set sizeAttrs = 'width="{{ item.max_width|escape_attr }}" height="{{ item.max_height|escape_attr }}" style="max-width: 100%; height: auto;"' %}
                                    {% endif %}
                                    {% set loadingAttr = item.loading != 'disabled' ? 'loading="{{ item.loading|escape_attr }}"' : '' %}
                                    <img data-src="{{ item.src }}" src="{{ item.src|escape_url }}" alt="{{ item.alt|escape_attr }}" {{ loadingAttr }} {{ sizeAttrs }}>
                                    {% endif %}
                </li>
                {% endfor %}
              </ul>
            </div>
          </section>
            </div>
      </div>  

What works for the splide.go() is:

                  $('.features-top-tab .button-primary-2').click(function() {
      let id = $(this).data('id');
            splide.go(id-1);  
  });

This corresponds to the data id with each “tab”, so clicking tab 1 corresponds to the 1st position in the carousel image and so on. The issue is going from the individual carousel to mutliple on the same page with different variable names. I thought maybe splideElement is the variable I needed but that didn’t work either.

For now each new splide on the page has a unique id of splide01 or splide 02 and so on

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật