Particles.js: Canvas size issue after resizing window

Created on 20 Jul 2020  路  2Comments  路  Source: VincentGarreau/particles.js

I'm initializing it this way

particlesJS.load('particles-js', '/assets/js/particles.json', function() { let el = document.querySelector(".particles-js-canvas-el"); el.setAttribute("height", "500px"); });

If I un-maximize the window and then maximize it back I get this weird behavior, the canvas gets almost 3 times bigger

Before
After

Particles.json

Most helpful comment

Oh, I think this project has not been abandoned, on the contrary it is very powerful and convenient. Please respect the author's work.

All 2 comments

Why settings those attributes programmatically? Use CSS, particles.js adjust itself automatically.

Anyway this project is abandoned, I recommend you the litghter alternative tsParticles

Oh, I think this project has not been abandoned, on the contrary it is very powerful and convenient. Please respect the author's work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

harshamv picture harshamv  路  3Comments

emilwibe picture emilwibe  路  4Comments

XRyu picture XRyu  路  6Comments

Necmttn picture Necmttn  路  6Comments

NoelAnnParisi picture NoelAnnParisi  路  4Comments