function initCarousels() { if (!$.fn.slick) return; var bannerCarousel = $("#banner-carousel"); var protectionPlansCarousel = $("#all-plans-carousel-generic:not(.kitfhelp-carousel)"); var currentProtectionPlan = $(".protection-plan-name"); if (typeof currentProtectionPlan !== "undefined") { var protectionPlanName = currentProtectionPlan.text().toLowerCase().replace(/ /g, "-"); if (protectionPlanName === 'autonation-vehicle-protection-plan') { $("#autonation-vehicle-care-program").addClass("active"); } $("#" + protectionPlanName).remove(); $(".carousel-indicators li:last-child").remove(); } bannerCarousel.slick({ dots: true, infinite: true, autoplay: true }); bannerCarousel.css("visibility", "visible"); if( protectionPlansCarousel.length > 0 ){ protectionPlansCarousel.slick({ dots: true, infinite: true, autoplay: true, autoplaySpeed: 2000, slidesToShow: 3, slidesToScroll: 1, responsive: [ { breakpoint: 769, settings: { slidesToShow: 2 } }, { breakpoint: 426, settings: { slidesToShow: 1 } } ] }); } } //$(function () { initCarousels(); //});