Next.js Discord

Discord Forum

Creating Confetti

Answered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
Hey,

How can i create Confetti in NextJS?

31 Replies

you can use an npm package. I am using this: https://www.npmjs.com/package/confetti-js
you can find a demo here: https://agezao.github.io/confetti-js/ @Tonkinese
TonkineseOP
Okay thank you
np, please mark solution
TonkineseOP
@B33fb0n3 I cant get it working
right click on my message -> apps -> mark solution
if you don't know how 🙂
TonkineseOP
No i mean the package i cant get it working 😉
you can update the css to the full VW and full VH. Maybe you want to set the position to absolute and the zindex to 100 or more
TonkineseOP
Yeah i want it to be over all components
so over the whole page
Do i have to make it in the layout?
you added this code to get it working: ^
Now you can change the css of the canva. You should put it somewhere to top or the bottom of the page. Not in the middle
TonkineseOP
Yes, i dont know how to place the canvas so that the confetti fits over the whole page
This is my problem you know
well, as I said, please place it on the top or the bottom. Not the middle:
TonkineseOP
When it is rendert, it stretches the full page
after you done that, you need to call the javascript code inside the same component: https://nextjs-forum.com/post/1184602609139581070#message-1184611400270749766
TonkineseOP
TonkineseOP
I had to do it like that:
@Tonkinese Click to see attachment
that looks better
TonkineseOP
Thank you ❤️
Answer
TonkineseOP
👍