$(document).ready(function () { if ($(".gallery-carousel").length) { $(".gallery-carousel").flickity({ // options cellAlign: "left", contain: true, wrapAround: true, pageDots: false, prevNextButtons: false, //autoPlay: 5000, imagesLoaded: true, adaptiveHeight: false, cellSelector: ".carousel-cell", }); var $carouselGall = $(".gallery-carousel").flickity(); var $carouselStatus = $(".carousel-status"); var flkty = $carouselGall.data("flickity"); function updateStatus() { var cellNumber = flkty.selectedIndex + 1; $carouselStatus.text(cellNumber + "/" + flkty.slides.length); } updateStatus(); $carouselGall.on("change.flickity", updateStatus); $(".gallery-nav").flickity({ asNavFor: ".gallery-carousel", contain: true, pageDots: false, prevNextButtons: false, groupCells: true, wrapAround: true, }); var $carouselNav = $(".gallery-nav").flickity(); $carouselNav.on("change.flickity", function (event, index) { $carouselGall.flickity("select", index); }); $("#carousel-next").on("click", function () { $carouselGall.flickity("next"); }); $("#carousel-prev").on("click", function () { $carouselGall.flickity("previous"); }); } });