I am trying to animate random properties on the x and y's
//generates a random right or left
var randX = function(){
var randXresult;
var startWith = Math.random()*5;
if(startWith>3){
randXresult="right";
}
else{randXresult="left"}
return randXresult
}
//generates a random top or bottom
var randY = function(){
var randYresult;
var startWith = Math.random()*5;
if(startWith>3){
randYresult="top";
}
else{randYresult="bottom"}
return randYresult
}
//generates a random number
var getRandomNo = function(){
var randomNo = Math.random()*9999;
return randomNo
}
// i am only showing the first .toggle() function
$(".innerColContainer div a").toggle(
function(){
$(this).parent().siblings().each(function(i){
Xrandom = randX()
Yrandom = randY()
alert(Xrandom+Yrandom) //this alerts the results i am looking for
//but how do i get the results in the .animate()
$(this).animate({ Xrandom:getRandomNo(), Yrandom:getRandomNo()}, 1400);
});
So my question is: How could i get that random
"top
" or "right
" inside the .animate()
since alert(Xrandom+Yrandom)
has the value i am looking for.