Hi Blake,
thank you for your quick response!
I knew my request was very general - im sorry for that
Thanks for your example!
I handle my request the same way to load new HTML content on click.
In my case, with the new content there are new elements added and I want to use this in a timeline.
In said timeline are DOM elements which are already present (index) but new ones should be added, e.g. like this:
// Elements from async loaded content:
elementsNewContent = [$('.no1'), $('.no2'), $('.no3')];
timeline.fromTo(elVar1, 1, {top: elVar2}, {top: 0, 'width': '100%', 'height': '420px', ease: Power3.easeOut}, "marker")
.fromTo(anotherVar, 1.7, {y: 600}, {y: 150, ease: Power4.easeOut}, "marker")
.fromTo(anotherVar, 0.7, {alpha: 0}, {alpha: 1, ease: Power4.easeIn}, "marker=0.3")
.staggerFromTo(elementsNewContent, 1, {y: 150}, {y: 0}, 0.1);
i have a array with links, on these links i registered an eventlistener, if one of those i clicked i want to assemble a timeline combined out of already existing elements from my index and some new one coming from my async loaded content, like this:
headerArr.forEach((el, i) => {
el.addEventListener('click', (elVar2) => {
function myTl() {
let elementsNewContent = [$('.no1'), $('.no2'), $('.no3')];
return ... timeline ... // defined as mentioned above
}
myTl().then(() => {
timeline.restart()
})
});
});
tried already so many variations, im just lost right now ... i guess i may misunderstand some of this logic in general, right?
Thank you very much for your help, i really appreciate!