Skip to content

Instantly share code, notes, and snippets.

@digiltd
Created June 26, 2014 12:39
Show Gist options
  • Save digiltd/8f2203b760466266a38a to your computer and use it in GitHub Desktop.
Save digiltd/8f2203b760466266a38a to your computer and use it in GitHub Desktop.
Loop through and add a random background-color (David Merfiel's randomColor.js) css property to selected element(s)
// ## Description
// Loop through and adds a random background-color css property to selected element(s)
// ## Requirements
// https://github.com/davidmerfield/randomColor
$(document).ready(function() {
$(".rand-bg-color").each(function() {
console.log('this ' + this);
$(this).css("background-color", randomColor({
luminosity: 'dark'
}));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment