Im using this code to generate random left position of an element and animate it to that position.
function moveBox() {
var randomSpeed = Math.round(Math.random()*200);
var bounceSpeed = defaultSpeed + randomSpeed;
var randomX = Math.round(Math.random()*200);
$("#box").animate({left:'"+='+randomX+'"', top:"+=20"},bounceSpeed, "linear", function(){moveBox();});
};
However its not working for some reason. The top animation works flawlessly because its just normal number. But the left property doesnt do anything, I think its something with the method i added the += and "" but cant figure out how to fix it.