I'm trying to achieve my dream in drawing useless bullshit. But after learning jQuery in 10 minutes, I ran into the problem that the delay function does not work as it should.
So, I have 500 black small divs with class "luls". The idea is that when you hover over them with a mouse, they light up in a random color, and after a certain time they take back the black color. BUT they NOT.
Take a Picture.
$(document).ready(function() {
$( ".luls" ).each(function(index) {
$(this).mouseenter(function() {
// It's just a random color function, do not focus on it.
var hue = 'rgb(' + (Math.floor((256-199)*Math.random()) + 200) + ',' + (Math.floor((256-199)*Math.random()) + 200) + ',' + (Math.floor((256-199)*Math.random()) + 200) + ')';
$(this).css("background-color", hue);
});
setTimeout(function() {
$(this).css('background-color', 'black');
}, 1000);
});
});
I tried to use delay() and setTimeout, even mouseover, but it does not work. Need your help.