Here is the latest code:
row = Math.ceil(height / (tile.height / 2));
column = Math.ceil(width / tile.width);
for (y=0 ; y<=row ; y++){
for (x=0 ; x<=column ; x++){
top = y * (tile.height / 2) - (tile.height / 2);
left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2) - (tile.height / 2);
$('<div />').addClass('tile').css({
width: tile.width,
height: tile.height,
top: top,
left: left
}).appendTo('body');
}
}
By the way, thanks to you that column/row mistake has been fixed.