A function

A function is a block of statements that can be used in a file.
I will create a function to change the color of my notes.

function colorMyNotes() {
    var i;
    var postItNoteColors = [
        '#FCF0AD', '#E9E74A', '#EE5E9F', '#FFDD2A', '#F59DB9', '#F9A55B', '#D0E17D', '#36A9CE', '#EF5AA1', '#AE86BC', '#FFDF25', '#56C4E8', '#D0E068', '#CD9EC0', '#ED839D', '#FFE476', '#CDDD73', '#F35F6D', '#FAA457', '#35BEB7', '#D189B9', '#99C7BC', '#89B18C', '#738FA7', '#8A8FA3', '#82ACB8', '#F9D6AC', '#E9B561', '#E89132', '#DA7527', '#DEAC2F', '#BAB7A9', '#BFB4AF', '#CDC4C1', '#CFB69E', '#D0AD87'];
    var i = 1;
    $('.col-md-4').each(function() {
        $(this).css('background-color', postItNoteColors[i]);
        i = (i + 1) % postItNoteColors.length;
    });
}
colorMyNotes();

The function works, however the color is always the same and it would be nice if it was random. Next, create an array that will randomize the color.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.