LoginSignup
0
0

More than 5 years have passed since last update.

背景色を定期的に変更する

Last updated at Posted at 2013-05-22
function setBackgroundColor(index) {
    var blue1 = 'rgba(52, 152, 219, 0.8)';
    var blue2 = 'rgba(41, 128, 185, 0.8)';
    var dark1 = 'rgba(52, 73, 94, 0.8)';
    var dark2 = 'rgba(44, 62, 80, 0.8)';
    var gray1 = 'rgba(149, 165, 166, 0.8)';
    var gray2 = 'rgba(127, 140, 141, 0.8)';
    var white2 = 'rgba(189, 195, 199,1.0)';

    var colors = [blue1, blue2, dark1, dark2, gray1, gray2, white2];

    if (!index || index > (colors.length - 1)) {
        index = 0;
    }
    var color = colors[index];

    setTimeout(function() {
        $('html').animate({
            backgroundColor: color
        }, 500);

        setBackgroundColor(++index);

    }, 30000);
}

$(document).ready(function() {
    setBackgroundColor();
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0