मैं कई स्थानों पर नीचेसमझाओ Math.floor (math.random())
$('a.random-color').hover(function() { //mouseover
var col = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';
$(this).animate({
'color': col,
'paddingLeft': '20px'
},1000);
},function() { //mouseout
$(this).animate({
'color': original,
'paddingLeft': '0'
},500);
});
});
इस्तेमाल क्यों किया जाता Math.floor()
और Math.random()
तरह Math.floor()
और Math.random()
का उपयोग कर देखा है?