Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mootrichard/2977b295e978c48d5af3 to your computer and use it in GitHub Desktop.
Save mootrichard/2977b295e978c48d5af3 to your computer and use it in GitHub Desktop.
A Pen by Richard Moot.
<div class="test"></div>
function randomNum(num, bottom){
return Math.floor((Math.random() * num) + bottom);
}
function randomColor(){
var a = randomNum(255, 0),
b = randomNum(255, 0),
c = randomNum(255, 0);
$(this).css('background', 'rgb('+a+','+b+','+c+')');
}
function randomScale(){
var a = randomNum(5, 1);
$(this).css('transform', 'scale('+a+')');
}
$('.test').on('click', randomColor);
$('.test').on('click', randomScale);
.test {
width:200px;
height:200px;
background:orange;
border-radius:50%;
margin:auto;
transition:all 500ms ease .15s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment