I want to change the position of div with for loop .. I made an animation .. When i click a div ( circle ) it moves to a position that is being determined with Math.random() .. I dont want to click the div to move to another position . I want to use for loop method and i want div to move another position in every 2 seconds or some seconds .. Do you have any advise .. Thanks
Click to see how it is
$(document).ready(function () {
$("#circle").click(function () {
var width = Math.random();
var yeniwidth = width * 500;
margin = Math.round(yeniwidth);
$("#circle").css("margin-top", margin + "px");
var height = Math.random();
var yeniheight = height * 1000;
margin2 = Math.round(yeniheight);
$("#circle").css("margin-left", margin2 + "px");
});
});