forked from davidjerleke/embla-carousel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3676-4ca4fdd6362d73858a68.js
2 lines (2 loc) · 1.58 KB
/
3676-4ca4fdd6362d73858a68.js
1
2
"use strict";(self.webpackChunkembla_carousel_docs=self.webpackChunkembla_carousel_docs||[]).push([[3676],{3676:function(e,t,n){n.r(t),t.default="\nconst addTogglePrevNextBtnsActive = (emblaApi, prevBtn, nextBtn) => {\n const togglePrevNextBtnsState = () => {\n if (emblaApi.canScrollPrev())\n prevBtn.removeAttribute('disabled');\n else\n prevBtn.setAttribute('disabled', 'disabled');\n \n if (emblaApi.canScrollNext())\n nextBtn.removeAttribute('disabled');\n else\n nextBtn.setAttribute('disabled', 'disabled');\n };\n \n emblaApi\n .on('select', togglePrevNextBtnsState)\n .on('init', togglePrevNextBtnsState)\n .on('reInit', togglePrevNextBtnsState);\n \n return () => {\n prevBtn.removeAttribute('disabled');\n nextBtn.removeAttribute('disabled');\n };\n};\n\nexport const addPrevNextBtnsClickHandlers = (emblaApi, prevBtn, nextBtn) => {\n const scrollPrev = () => {\n emblaApi.scrollPrev();\n };\n const scrollNext = () => {\n emblaApi.scrollNext();\n };\n prevBtn.addEventListener('click', scrollPrev, false);\n nextBtn.addEventListener('click', scrollNext, false);\n \n const removeTogglePrevNextBtnsActive = addTogglePrevNextBtnsActive(emblaApi, prevBtn, nextBtn);\n \n return () => {\n removeTogglePrevNextBtnsActive();\n prevBtn.removeEventListener('click', scrollPrev, false);\n nextBtn.removeEventListener('click', scrollNext, false);\n };\n};\n"}}]);
//# sourceMappingURL=3676-4ca4fdd6362d73858a68.js.map