Untitled

 avatar
unknown
plain_text
5 months ago
1.2 kB
4
Indexable
window.addEventListener('load', function() {
  console.log("Page has loaded!");

  // Iterate through each carousel separately
  jQuery('.bx-quote-block').each(function(carouselIndex, carousel) {
    // Find the active slide for the current carousel
    var activeSlide = jQuery(carousel).find('.tns-slide-active');
    var sliders = activeSlide.find('.bx-animation__curtain-image'); // Find image elements within the active slide

    // Classes to toggle
    var existingClass = 'bx-quote-block__inner'; 
    var newClass = 'bx-quote-block__inner_2'; 

    // Check if active slide has images and toggle classes accordingly
    if (sliders.length) {
      activeSlide.closest('.bx-quote-block__outer').removeClass(newClass).addClass(existingClass);
      activeSlide.closest('.bx-quote-block-left__content').removeClass('bx_quote_block_leftContent_hide');
      console.log("Image here in carousel:", carouselIndex);
    } else {
      activeSlide.closest('.bx-quote-block__outer').removeClass(existingClass).addClass(newClass);
      activeSlide.closest('.bx-quote-block-left__content').addClass('bx_quote_block_leftContent_hide');
      console.log("Image not here in carousel:", carouselIndex);
    }
  });
});
Editor is loading...
Leave a Comment