AI 2
by Chris Nicholson
CSS
div {
position: absolute;
top: 0;
left: 0;
height: 100px;
width: 100px;
background: red;
}
JavaScript
$(document).ready(function(){
var fixes = new Array();
//fix.push = new Array(2);
//fix[0][0] = 2;
var i = 0;
// Move initially
$('div').animate({ top: '100px' }, 1000, 'linear', function(){
// Knock left or right randomly
$('div').css('left', '20px');
fixes.push.bumpedAmount = '20';
$('div').animate({ top: '200px', left: 0 }, 1000, 'linear');
});
i++;
});
function fix(bumpedAmount, fixedAmount, success){
this.bumpedAmount = bumpedAmount;
this.fixedAmount = fixedAmount;
this.success = success;
}