0

enter image description here

I can see that scrollbar on x-axis.

But, when using mouse wheel on that section it didn't work..

If you know, please help me ..

This is my code

 <div className="flex space-x-3 overflow-scroll p-3 -ml-3">
            {cardsData?.map(({ img, title }) => (
              <MediumCard key={img} img={img} title={title} />
            ))}
          </div>

and mediumCard code

const MediumCard = ({ img, title }) => {
  return (
    
    <div className="cursor-pointer transform transition hover:scale-105 duration-300 ease-out ">
      <div className="relative h-80 w-80">
        <Image src={img} layout="fill" className="rounded-xl" />
      </div>
      <h3 className="text-2xl mt-3">{title}</h3>
    </div>
  );
};
1
  • Horizontal scroll on mousewheel is not a native behavior. If you want that you'll need some JS or you could use this hack and adapt it to Tailwind css-tricks.com/pure-css-horizontal-scrolling Commented Nov 22, 2021 at 22:06

1 Answer 1

1

Please add width and height to this

 <div className="w-[100vw] flex space-x-3 overflow-scroll p-3 -ml-3">
        {cardsData?.map(({ img, title }) => (
          <MediumCard key={img} img={img} title={title} />
        ))}
      </div>
Sign up to request clarification or add additional context in comments.

2 Comments

Width & Height important. Thanks
Where are you adding height here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.