Categories
html image javascript jquery

What is wrong with this code

function moveit() {
var newTop = Math.floor(Math.random()*350);
var newLeft = Math.floor(Math.random()*1024);
var newDuration = 9000
$('#friends').animate({
top: newTop,
left: newLeft,
!!! --> width: "+="+((newTop-$('friends').css('top'))*3),
}, newDuration, function() {
moveit();
});
}
$(document).ready(function() {
moveit();
});

It is supposed to make an image fly around (works).
I added the line marked with the “!!! –>” that should make the image get bigger the closer it is to the bottom of the page.

What did I do wrong? The code doesn’t throw any errors.