Updating multiple classes with random background colors
At the moment I have a website at
http://projects.jack-spence.com/mortune/index.html . However I would like
to change the background colors on the cards (When they're flipped) to a
random color.
I'm currently using
<script>
function get_random_color() {
var letters = '0123456789ABCDEF'.split('');
var color = '#';
for (var i = 0; i < 6; i++ ) {
color += letters[Math.round(Math.random() * 15)];
}
return color;
}
$(function() {
$(".face,.back").each(function() {
$(this).css("background-color", get_random_color());
});
});
</script>
At the moment. But it won't update multiple classes as I need it to update
".face.back " and it just doesn't seem to work... I don't know if I've
given enough detail. But any help would be greatly appreciated!
No comments:
Post a Comment