I have a div moving in a loop (with jquery). I am able to write the x,y position to the page; however, only the initial values get written to the page. Is there a way to update the values as the div moves?
var sun = $j(".sun");
var position = sun.position();
$j(".sun").circulate({
speed: 3600,
width: Wwidth,
height: Wwidth,
loop: true,
zIndexValues: [1000, 1000, 1000, 1000]
});
console.log('x: ' + position.left + ' y: ' + position.top);
Either you modify the circulate plugin you are using so it makes a callback every time it changes the position of the sun. Or you can just put your reading part in a setInterval statement: