react-confetti icon indicating copy to clipboard operation
react-confetti copied to clipboard

Not taking full height

Open mahiros-tech opened this issue 2 years ago • 4 comments

Hi, I am using Confetti, but it's not taking full height. It uses innerHeight so it's only taking the viewport height from the top Y (=0). The issue is that, when the page has the content exceeds the height and scroll appears. And I scroll down to the bottom of the page, and I can not see the Confetti shapes. How can I solve this? Thanks.

mahiros-tech avatar Sep 29 '22 15:09 mahiros-tech

Same here. When page is scrolled to the bottom, I don't see the confetti.

kkomelin avatar Nov 26 '22 19:11 kkomelin

One fix is just to swap it out for document.body.scrollHeight which will take the entire height of the document.

import Confetti from 'react-confetti'

const Foo = () => {
    let width = window.innerWidth
    let height = document.body.scrollHeight

    return <div>
        <Confetti
            width={width}
            height={height}
            recycle={true}
            run={true}
            gravity={0.2}
        />
    </div>
}

tomwilson2 avatar Dec 01 '22 16:12 tomwilson2

Hi, i am adding a confetti mid section not at the top, and i have added state to run confetti when div is reached. My state is working, when i reach the div the confetti appears but it doesnt appear on the div. it appears on the top of my screen.

How do i fix this?

karimdakroury avatar Feb 02 '23 07:02 karimdakroury

Hi, i am adding a confetti mid section not at the top, and i have added state to run confetti when div is reached. My state is working, when i reach the div the confetti appears but it doesnt appear on the div. it appears on the top of my screen.

How do i fix this?

If you did not configure the confettiSource attribute, you might want to look into that!

peanutsee avatar Nov 16 '23 13:11 peanutsee