I'm keen on creating a marquee animation using Tailwind and Next.js

I'm working on creating a marquee animation using Tailwind CSS and Next.js, and I've made some progress. However, the issue I'm facing is that the items are not displaying one after the other smoothly; there seems to be a delay when the second item appears.

What I want it to look like: https://i.stack.imgur.com/5AKUJ.png but currently, it looks like this https://i.stack.imgur.com/x48lE.png.

Below is the Tailwind CSS code:

.animate-marquee {
    animation: marquee 10s linear infinite;
    float: left;
}

Here is the component code:

import { useRouter } from "next/router";
import pathChecking from "../../utils/pathChecking";
import Image from "next/image";

const testimonial_data = [
{
desc: "Inform, inspire, connect, and collaborate for meaningful action.",
id: "0General Partner at Entrepreneur",
},
{
desc: "Addressing the world’s biggest environmental and social challenges.",
id: "1General Partner at Entrepreneur",
},
{
desc: "Fun, interactive, and immersive technology for real-world positive outcomes. ",
id: "2General Partner at Entrepreneur",
},
];

const HeroSliderComponent = () => {
const route = useRouter();

return (
<>
<div className=" flex animate-marquee space-x-8 w-10000">
{testimonial_data.map((item, index) => {
const { id, img, title, desc, name } = item;
return (
<div className="text-white" key={id}>
<div
className={`relative rounded-2.5xl border border-jacarta-100 bg-white p-12 transition-shadow hover:shadow-xl dark:border-jacarta-700 dark:bg-jacarta-700 `}
>
<p className="block font-display text-xl font-medium group-hover:text-accent dark:text-white text-center">
{desc}
</p>
</div>
</div>
);
})}
</div>
</>
);
};

export default HeroSliderComponent;

I'm aiming for an infinite marquee with smooth transitions between items.

Answer №1

Feel free to test out the code snippet below:

import { useRouter } from "next/router";
import pathChecking from "../../utils/pathChecking";
import Image from "next/image";

const testimonial_data = [
  {
    desc: "Empower, engage, and create impact through collaboration.",
    id: "0General Partner at Entrepreneur",
  },
  {
    desc: "Solving the world’s most pressing environmental and social issues.",
    id: "1General Partner at Entrepreneur",
  },
  {
    desc: "Innovative technology for positive real-world results with a touch of fun.",
    id: "2General Partner at Entrepreneur",
  },
];

const HeroSliderComponent = () => {
  const route = useRouter();

  return (
    <div className="flex overflow-hidden">
      {[1, 2].map((num) => {
        return (
          <div
            key={num}
            className="min-w-full flex animate-marquee space-x-8 w-10000"
          >
            {testimonial_data.map((item, index) => {
              const { id, img, title, desc, name } = item;
              return (
                <div className="text-white" key={id}>
                  <div
                    className={`relative rounded-2.5xl border border-jacarta-100 bg-white p-12 transition-shadow hover:shadow-xl dark:border-jacarta-700 dark:bg-jacarta-700 `}
                  >
                    <p className="block font-display text-xl font-medium group-hover:text-accent dark:text-white text-center">
                      {desc}
                    </p>
                  </div>
                </div>
              );
            })}
          </div>
        );
      })}
    </div>
  );
};

export default HeroSliderComponent;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Pictures failing to display in their designated location

Having trouble with my social media icons on the page. They either get hidden by other divs despite having a higher z-index or appear below the top section. I want them to be positioned to the right of the church image. I've tried different approaches ...

What is the best way to adjust the size of an image within a div element using HTML?

I've created a Carousel with 5 images to display. However, I'm having an issue where only the image is showing up, and I want the text and button to appear below it. Here's how the nature image is currently displaying: What I want is for th ...

Tips for ensuring only one submenu is open at a time

I have successfully created a responsive menu that is working well. However, I am facing an issue. I want only one menu to be open at a time. When a submenu is opened, the other menus should be hidden. How can I achieve this? Below is my Script code $( ...

Upcoming topics - The Challenge of Staying Hydrated at Basecamp One

I have implemented a themes package for dark mode and light mode in my project. Despite doing the installation correctly as per the repository instructions, I am encountering an issue. My expected behavior for the project is: The webpage should initially ...

floating containers aligned side by side in a perfectly positioned parent container

I'm currently working on aligning a set of buttons within a DIV popup that I've created. My goal is to have the buttons positioned next to each other, but I'm having trouble achieving this. I've attempted using 'float: left', ...

What steps should I take to resolve the textarea border bottom CSS effect?

My simple border bottom animation is working fine with a basic input element, but it's not functioning properly when used with a textarea. (If using JavaScript is necessary for a solution, please provide guidance) How can I adjust the height of a te ...

Passing a variable to the render method in a PDF document

I'm currently working on a project with Django where I need to convert an HTML monthly report into a PDF. The data for the report is retrieved from a database based on the selected month. I am facing an issue in sending the selected month from the HTM ...

CSS - positioning the sidebar on the far left edge of the screen (refer to image)

Is there a way to create a layout similar to this design: For a demonstration, see here: http://jsfiddle.net/ymC82/ Current HTML code: <div class="wrapper"> <aside> Sidebar </aside> <article> ...

The process of running npx create-react-app with a specific name suddenly halts at a particular stage

Throughout my experience, I have never encountered this particular issue with the reliable old create-react-app However, on this occasion, I decided to use npx create-react-app to initiate a new react app. Below is a screenshot depicting the progress o ...

CSS code influencing unintended elements

www.geo-village.com <- Live Example After setting up my main webpage with CSS and PHP files, I noticed an issue with the navigation bar. Despite having a separate PHP and CSS file for the navigation bar items, the Login and Register buttons on the main ...

Steps for implementing target='_blank' on a <Link> tag with more than just an <a> element inside

I'm facing an issue where I need to open a new browser tab and redirect to a specific URL when a button is clicked. The problem arises when using an element other than an anchor tag inside the Next's <Link> element, as it seems to ignore th ...

Introducing an innovative Serverless Multi-user Blogging Platform utilizing Next.js, Tailwind, and AWS CLI for seamless content creation and management

Seeking assistance as I may have overlooked a step. Any guidance is appreciated! Recently, I managed to deploy a full-stack serverless nextJs application on AWS Amplify successfully. I made modifications by adding a new field while creating a new blog pos ...

Eliminate certain inline styles using jQuery

I am facing an issue with an asp menu I am using. It is automatically inserting style="width:3px;" into my menu table tds, creating an unsightly gap between my tabs. Instead of asking our developer to customize the menu just to fix this cosmetic flaw, I am ...

Enhancing Data Retrieval in Next.js: Implementing Typed Requests and Responses with the Fetch API

Context I've been developing a web application using Next.js and a custom Django Python backend, but I am struggling to find an efficient approach for making API requests from my frontend to the backend. My main goal is to centralize the logic for fet ...

Using the max-width property with Semantic UI Dropdown in ReactJS

I'm struggling to determine how to adjust the max-width of the Dropdown element in ReactJS. I attempted the following: .Menu Dropdown { max-width: 5rem !important; } Unfortunately, this did not work as expected. The dropdowns are taking up too m ...

My navigation bar's CSS code falls short of extending across the full width of my screen, leaving a gap of approximately 10 pixels before reaching the edges

Can someone help me figure out what went wrong? I've been trying to remove the margins but it's not working. The background colors of other elements seem to be seeping into this empty space. Any thoughts or suggestions would be greatly appreciate ...

What is the process for updating the background color of the header in ngx datatable?

I am looking to change the background color of the table header to blue. This is the HTML code I have: <ngx-datatable class="material" [rows]="rows" [columnMode]="'force'" [headerHeight]="50" [footerHe ...

What is the secret behind Facebook's ability to keep the chat bar fixed at the bottom of the browser window?

I am curious to learn about the method Facebook uses to keep the chat bar at the bottom of the browser window even when we scroll through the page. ...

CSS Background Color Not Displaying Correctly

My HTML5 page has an issue where the image is taking over the background color of the entire page. I want to adjust it so that the image appears in the background, while the background color shows up behind the content on top. Check out my code below and l ...

Should the potential benefits of implementing Responsive Design in IE8 be taken into account in 2013?

It seems that there are still questions lingering about how to make responsive design compatible with outdated browsers like IE8 or even the dreaded IE7. Personally, I question the need for implementing responsive design specifically for IE8, considering ...