wufe / react-particles-js

Particles.js for React
https://rpj.bembi.dev/
MIT License
1.15k stars 106 forks source link

Why particles.js height not expanding? #74

Closed seyedasfar closed 5 years ago

seyedasfar commented 5 years ago

https://stackoverflow.com/questions/54359429/why-particles-js-height-not-expanding

tdar31 commented 5 years ago

Absolutely not an ideal solution but it did work for me. I created an app.css file and have my app.js import it. Inside the CSS file I have the following:

canvas { width: 100%; height: 100%; position: fixed; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat; }

Basically I used the stackoverflow post below but tweaked it for React to modify the canvas tag since you can't access the '#particles-js' id since it's imported as a component. As I said earlier not ideal at all and I'm sure there is a better way to do this but I did manage to get it to work (somehow)

https://stackoverflow.com/questions/45405463/particles-js-not-covering-entire-page (did not need to use the .body-particles styles this answer refers to in order for it to work)

Hope this helps

wufe commented 5 years ago

You can use style or canvasClassName props to set canvas css. Please refer to the main readme. Answers given, closing.