Color changing too fast for the div
Color is changing too frequently on mouse move, however I want it to
delayed and make it smooth but the code is not working properly.
I introduced delay() for this but seems not working.
Let me know what I am missing in the concept for using delay in the code.
jQuery Code-
var possible = 'ABCDEF123456';
var stringLength = 6;
$('#divcol').on('mousemove',function(){
var randomString = Array.apply(null, new
Array(stringLength)).map(function () {
return possible[Math.floor(Math.random() * possible.length)];
}).join('');
var col = "#"+randomString;
$(this).delay(10000).css("background-color",col);
})
HTML -
<div id="divcol" style="width:150px;height:150px;background-color:#c3c3c3;">
</div>
Fiddle - http://jsfiddle.net/83mN7/
Something like this I am trying to achieve - http://www.aino.com/
No comments:
Post a Comment