We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Before I ask my question I have to do a little explaining...
My purpose and goal for using P5.js to load in templates and display them in the DOM in order to manipulate them to appear as if they are being assembled and dissembled between "god page" transitions (a Backbone Framework). The view for each route would use P5.js's position() method to move the newly copied and created DOM elements to their final resting state on the page by appending them off the visible screen (and promptly disabling scrolling using the overflow hidden method on the body) and then slowly transitioning them back to their intended position on the screen with easement.
Currently I have a non-P5.js version of this where I use a margin large enough not to be visible in a random direction (this part I already have working) and then using the JQuery animate method to slowly reduce the margin making the appearance of DOM elements assembling on the page. Removing the elements from the DOM was easy, but appending them is way more difficult which is why I wanted to use P5.js as the agent that does the movement and transition.
Using JQuery's $.get() method I am able to grab templates from files, then I use P5's createElement() to create a DIV with the template as my content. i.e "createElement("div",template)". From there I am able to give it an attribute("id", "dash1") and append it to the DOM and it renders fine as a DOM element, however, if I create multiple instances of this object the two rendered objects stack on themselves in the body even when I try to append one to the other. I have assigned both an ID attribute, so in non-P5 instances this method of grabbing templates and inserting them into each other would work fine. However, in P5.js I assume the created elements are treated differently in Setup() and I was wondering if anyone would be able to shed some light on the subject.
That was a lot of explanation for a small question, but hopefully it explains thoroughly what I am trying to do.