I'm having quite a bit of trouble with this. Here's what I have so far:
var findPos = function(obj){
var curLeft = 0;
var curTop = 0;
var arr = [];
curLeft += obj.offsetLeft;
curTop += obj.offsetTop;
arr[arr.length] = {x: curLeft, y: curTop};
return arr;
}
This only returns the starting position of the element passed into the function. But as the object move, I want it to store every position (x, y) in the array that is returned. Any suggestion as to how this can be done? I have tried recursion but that didn't really work out.
The element is moving using CSS @keyframes
if that is relevant.