JSFiddle - React, Tailwind, and code Playground
CSS
body {
width:1500px;
}
.sameDiv{
background:#eee;
width:50px;
height:50px;
border:solid 1px #ccc;
margin: 0px 5px 5px 0px;
float:left;
}
JavaScript
var colBoxNum = 20;
var rowBoxNum = 20;
for(var i = 0; i<rowBoxNum; i++){
for(var j = 0; j<colBoxNum; j++){
var id = j + (i*colBoxNum);
$('<div />').addClass('sameDiv').attr('id','div' + id.toString())
.text(id).appendTo('body');
}
}
var randInt = parseInt((Math.random()*1000)) % ($('.sameDiv').length)
var seat = $('#div' + randInt.toString());
$('html,body').animate({
scrollTop: seat.offset().top-20,
scrollLeft: seat.offset().left-20
},'slow');
$('html,body').promise().done(function(){
seat.hide().css('background','yellow').fadeIn(1000);
});