Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Let’s play around with Carousel marquee ✌️
Nitin Reddy
Nitin Reddy

Posted on

     

Let’s play around with Carousel marquee ✌️

Today we will look at how we can create a carousel marquee view and customise it according to our requirements.

To experiment with the carousel view, we will

  1. Create a newcodesandbox project.
  2. Select a React boiler plate template

and boo-ya the project would be created for you.

Now in the styles.css, update the code with the below CSS.

.App{font-family:sans-serif;text-align:center;}.wrapper{max-width:100%;overflow-y:auto;}.marquee{white-space:nowrap;overflow:hidden;display:inline-block;animation:marquee50slinearinfinite;}.marqueep{display:inline-block;}.item{float:left;margin-right:50px;margin-bottom:50px;border:1pxsolid;}.item:last-child{margin-right:0;}@keyframesmarquee{0%{transform:translate3d(0,0,0);}100%{transform:translate3d(-100%,0,0);}}
Enter fullscreen modeExit fullscreen mode

Update your App.js file with the below code,

import "./styles.css";export default function App() {  const items = [    {      name: "Test1",      url: "https://upload.wikimedia.org/wikipedia/commons/1/11/Test-Logo.svg"    },    {      name: "Test2",      url:        "https://images.pling.com/img/00/00/48/70/84/1220648/e4fff450a6306e045f5c26801ce31c3efaeb.jpg"    },    {      name: "Test3",      url: "https://upload.wikimedia.org/wikipedia/commons/8/85/Logo-Test.png"    },    {      name: "Test4",      url:        "https://static6.depositphotos.com/1014550/624/i/950/depositphotos_6240474-stock-photo-test-word-on-keyboard.jpg"    },    {      name: "Test5",      url: "https://upload.wikimedia.org/wikipedia/commons/1/11/Test-Logo.svg"    },    {      name: "Test6",      url:        "https://images.pling.com/img/00/00/48/70/84/1220648/e4fff450a6306e045f5c26801ce31c3efaeb.jpg"    },    {      name: "Test7",      url: "https://upload.wikimedia.org/wikipedia/commons/8/85/Logo-Test.png"    },    {      name: "Test8",      url:        "https://static6.depositphotos.com/1014550/624/i/950/depositphotos_6240474-stock-photo-test-word-on-keyboard.jpg"    }  ];  return (<divclassName="App"><h1>Caoursel marquee</h1><divclassName="wrapper"><divclassName="marquee">          {items.map(({ url, name }) => {            return (<divclassName="item"onClick={()=> window.open(url, "_blank")}              ><imgsrc={url}width="100"height="100"alt={name}/></div>            );          })}</div></div></div>  );}
Enter fullscreen modeExit fullscreen mode

So easy, right? You can find theproject oncodesandbox

Credits

Thanks in advance for reading this article...🚀

I am more than happy to connect with you on

You can also find me on

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Seasoned JavaScript Developer who loves to explore other programming languages like Python. A problem solver, tech lover by heart. Loves reading booking, and cooking. 🤩🚀🔬
  • Location
    Pune, India
  • Education
    CS Graduate
  • Work
    Senior Software Engineer at IglooInsure
  • Joined

More fromNitin Reddy

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp