Firstly I have to say how amazing gsap is, I've used it in as for many years and I've finally taken the plunge to the js version and I have to say I'm loving it!!
So.... I'm trying to write an app that dynamically loads in html views and adds them to the dom, I then create timelines to manipulate the views and store these in the app for reuse later on.
The problem I'm having is that when I remove the html from the dom (say for instance I was loading another view) and then add it back again the timelines are no longer attached to the view.
I've created a codepen to illustrate this: http://codepen.io/KingDaddy/pen/swxga
1. If you play the timeline it works
2. Hit "remove and add back to dom"
3. The timeline plays but no longer is attached to the box
I realise I can kill the timeline and add it back again but I will have many views/timelines in my app and I would prefer not to have to reset them when loading each view.
Any ideas what I'm doing wrong here and how I can reattach the timeline?