From 548c9396d7c10ba226b62fb799d5784ad714b208 Mon Sep 17 00:00:00 2001 From: LavaC <48022591+LavaCxx@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:23:52 +0800 Subject: [PATCH] feat: swiper enable side scrolling event (#1276) * feat: swiper enable side scroll * fix: format code --- src/components/home/PostCover.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/home/PostCover.tsx b/src/components/home/PostCover.tsx index e4bbf62e..a8a02ee0 100644 --- a/src/components/home/PostCover.tsx +++ b/src/components/home/PostCover.tsx @@ -4,7 +4,7 @@ import "swiper/css" import "swiper/css/navigation" import "swiper/css/scrollbar" -import { Navigation, Scrollbar } from "swiper/modules" +import { Mousewheel, Navigation, Scrollbar } from "swiper/modules" import { Swiper, SwiperSlide } from "swiper/react" import { Image } from "~/components/ui/Image" @@ -42,7 +42,10 @@ export default function PostCover({ scrollbar={{ hide: true, }} - modules={[Navigation, Scrollbar]} + mousewheel={{ + forceToAxis: true, + }} + modules={[Navigation, Scrollbar, Mousewheel]} className="w-full h-full" > {images?.map((image) => (