Let CSS do background-color conversion (faster than JS):
#lock {
background-color: yellow;
transition: background-color 0.3s;
}
#lock.red {
background-color: red;
}
Now, after loading the DOM, add the following JavaScript before closing the tag <body>:
setTimeout(function() {
var element = document.getElementById('lock');
element.classList.add('red');
}, 4000);
$('#lock').delay(4000).addClass('red');
Edit
, , . delay (, ). - , JS:
var $table = $("#lock");
$table.css("background-color", "yellow");
setTimeout(function () {
$table.css("background-color", "red");
}, 4000);
, CSS.
.