diff --git a/src/widgets/welcome/ui/index.tsx b/src/widgets/welcome/ui/index.tsx index aaebefc..b256130 100644 --- a/src/widgets/welcome/ui/index.tsx +++ b/src/widgets/welcome/ui/index.tsx @@ -26,17 +26,25 @@ const Welcome = () => { const [api, setApi] = useState(); const scrollPrev = () => { - api?.scrollPrev(); + if (api?.canScrollPrev()) { + api?.scrollPrev(); + } else if (!api?.canScrollPrev()) { + api?.scrollTo(api?.slideNodes().length - 1); + } }; const scrollNext = () => { - api?.scrollNext(); + if (api?.canScrollNext()) { + api?.scrollNext(); + } else if (!api?.canScrollNext()) { + api?.scrollTo(0); + } }; return (
- + {banner.map((e, index) => ( @@ -52,7 +60,7 @@ const Welcome = () => {