Meteor not rendering background until reload


#1

I’m using particles.js via newswim’s package (https://atmospherejs.com/newswim/particles) as a background for an app I’m working on. However, the particles only load immediately on the home page and do not load on any other pages unless I reload those pages. Furthermore, the particles do not load if I navigate back to the home page using the back button (unless I then reload the home page). How is this happening? Shouldn’t Meteor.startup() guarantee that the particles are loaded?


#2

I believe the reason for this is that you are creating new DOM elements without running the code that creates the particles. You’ll either need to stop the destruction and recreation of the element that will contain the particles, or run the particle generation code in the onRendered of each page template.