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