Will try to explain the issue, sorry if it doesn't make sense: I'm trying to update a variable inside an object while looping. Trying to target all the parents of class elements to use on scrollmagic plugin. This is what my code looks like:
var childElement = $('.child');
var myparents = [];
var getParent = function () {
childElement.each(function() {
var theParent = $(this).closest('.parent');
myparents.push(theParent);
});
}();
for (var i=0; i<childElement.length; i++) {
// also using the loop to add animation to every element,
// that's why the loop through other elements
new ScrollMagic.Scene({
// here is where I would need to access each
triggerElement: myparents[i],
triggerHook: 'onEnter'
})
}
The elements are added successfully to the array, and can use them, but can't access them inside this scrollmagic (object?). Thanks a lot to anyone for providing assistance.