Hi all,
I was wondering if you could help me out - here is my codePen:
http://codepen.io/marklawrencedesign/pen/KNgdxL
This pen simulates the real-life issue I am having using Ajax, except for demo purposes I am using '.append()'
I have been as descriptive as possible in the pen to articulate the specific issue, but I will explain again here:
I need to animate an ajax-loaded article on button click 'open' I realise that the loaded content will not be seen by the TL if I declare my variables pointing to these elements on page-load, therefore I am tying the 'master.add(...)' when the button is clicked / ajax content is available in the DOM. The pen works, the loaded content is indeed added to the page, and it animates as expected ONLY on the first play / close.
If you click play, and then close a few times in the pen you will notice the animations still plays, but there is a progressively longer gap between each stage of the animations.
Is it because on each 'open' click I am again adding to the master, and it is getting 'clogged' up? If so what should I do to clear the 'master.add(...)'?
I have done a LOT of googling but I cannot find an answer, and I think I have gone in a big circle of pain.
...awesome product btw (when I can make it play ball )
Thanks in advance if you can help.
Also - is there a better // more practical method to my code setup for this in general? It would be awesome for a GSAP Jedi to offer me advice - Im always looking for ways to improve how I approach things.