(function($){ // Function to destroy slick once detected function killSlick(){ var $carousel = $('.af-banner-carousel-1'); if($carousel.length){ $carousel.each(function(){ var $this = $(this); if($this.hasClass('slick-initialized')){ try { $this.slick('unslick'); console.log('Slick unslicked:', $this); } catch(e){ try { $this.slick('destroy'); console.log('Slick destroyed fallback'); } catch(e2){} } } }); } } // Try on DOM ready and window load $(document).ready(killSlick); $(window).on('load', killSlick); // MutationObserver → catches late or repeated inits var observer = new MutationObserver(function(mutations){ killSlick(); }); observer.observe(document.body, { childList: true, subtree: true }); })(jQuery);