Coder Social home page Coder Social logo

Comments (6)

jizhi0v0 avatar jizhi0v0 commented on July 2, 2024 1

@jizhi0v0 I found what was causing the issue! In my reset.scss, I was doing


* {

  box-sizing: border-box;

  margin: 0;

  padding: 0;

  overflow-x: hidden;

  max-width: 100vw;

}

Not sure which property was causing the issue but I just replaced "*" with "body". Now it works! So in the end, nothing was wrong with versioning or the swiper itself :) Thanks for your time!

Congratulations!Your websites are pretty!I'm a beginner.

from next.js.

jizhi0v0 avatar jizhi0v0 commented on July 2, 2024

I tried in my project use the same package.json.The different was i didn't use the sass.

"use client";

import { Swiper, SwiperSlide } from "swiper/react";
import "swiper/scss";
import "swiper/scss/pagination";
import { Autoplay, Pagination } from "swiper/modules";
import Image from "next/image";
import slide1 from "@/public/assets/img/surfboard.jpg";
import slide2 from "@/public/assets/img/beach-surfers.jpg";
import slide3 from "@/public/assets/img/homepage-bg.jpg";

const Carousel: React.FC = () => {
  const images = [slide1, slide2, slide3];

  return (
    <>
      <Swiper
        pagination={{ clickable: true }}
        modules={[Pagination, Autoplay]}
        autoplay={{
          delay: 3000,
        }}
        style={{ width: "100%", height: "100%" }}
      >
        {images.map((imageUrl, index) => (
          <SwiperSlide key={index}>
            <div>
              <Image
                src={imageUrl}
                alt="image"
                layout="fill"
                objectFit="cover"
              />
            </div>
          </SwiperSlide>
        ))}
        <div></div>
      </Swiper>
    </>
  );
};

export default Carousel;

CleanShot.2024-05-10.at.14.34.24.mp4

from next.js.

thomasaugot avatar thomasaugot commented on July 2, 2024

Crazy... I copy your code, removed the scss and I still get the exact same issue. And this with any kind of carousels I have tried. It must be something else in my code I don't know...

from next.js.

jizhi0v0 avatar jizhi0v0 commented on July 2, 2024

exact

Yeah,I runned your code and got the same error.

Can you new a clean project then one by one to add these functions.

Maybe i can try this tomorrow if i have more free time.

from next.js.

thomasaugot avatar thomasaugot commented on July 2, 2024

@jizhi0v0 I found what was causing the issue! In my reset.scss, I was doing

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
}

Not sure which property was causing the issue but I just replaced "*" with "body". Now it works! So in the end, nothing was wrong with versioning or the swiper itself :) Thanks for your time!

from next.js.

github-actions avatar github-actions commented on July 2, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

from next.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.