Created
March 6, 2011 07:28
-
-
Save thunsaker/857108 to your computer and use it in GitHub Desktop.
Randomly Select a predefined list of background colors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$('.links_wrapper a').hover( | |
function () { | |
var hue = Math.floor(Math.random() * 256); | |
switch (hue % 3) { | |
case 0: | |
// orange | |
$(this).css('background', '#FC9E00'); | |
break; | |
case 1: | |
// green | |
$(this).css('background', '#4FBA00'); | |
break; | |
case 2: | |
// gray | |
$(this).css('background', '#818181'); | |
break; | |
default: | |
// orange | |
$(this).css('background', '#FC9E00'); | |
break; | |
} | |
}, | |
function () { | |
$(this).css('background', 'white'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment