Skip to content

Instantly share code, notes, and snippets.

@alperbayram
Created March 27, 2022 13:33
Show Gist options
  • Save alperbayram/c9615f64ba58a7c0aa3fd2a4c6535480 to your computer and use it in GitHub Desktop.
Save alperbayram/c9615f64ba58a7c0aa3fd2a4c6535480 to your computer and use it in GitHub Desktop.
Swiperjs Prev/Next Buttons Değiştirme
// Import Swiper React components
import { Swiper, SwiperSlide } from "swiper/react";
// Import Swiper styles
import "swiper/css";
import "swiper/css/navigation";
import "./style.css";
// import required modules
import { Autoplay, Navigation } from "swiper";
const images = [
{
id: 1,
href: "https://images.unsplash.com/photo-1519293978507-9c6bb9f82eda?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80",
},
{
id: 2,
href: "https://images.unsplash.com/photo-1485081669829-bacb8c7bb1f3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80",
},
{
id: 3,
href: "https://images.unsplash.com/photo-1522277245807-5e608aa8adcd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80",
},
{
id: 4,
href: "https://images.unsplash.com/uploads/14126758789351371c7ec/aa322c2d?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1474&q=80",
},
];
export default function Carousels() {
const navigation = {
clickable: true,
renderBullet: function (className) {
return '<span class="' + className + '">' + "</span>";
},
};
return (
<>
<Swiper
spaceBetween={30}
autoplay={{
delay: 2500,
disableOnInteraction: false,
}}
navigation={navigation}
modules={[Autoplay, Navigation]}
className="mySwiper"
>
{images.map((image) => (
<SwiperSlide>
<img
src={image.href}
alt="natural"
/>
</SwiperSlide>
))}
</Swiper>
</>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment