简介
此代码用在了导航页中。具体到此 自用导航 就是一个随机变幻背景色的js代码
代码
var bodyBgs = [];
bodyBgs[0] = "135deg, #A0FE65 10%, #FA016D 100%";
bodyBgs[1] = "135deg, #5EFCE8 10%, #736EFE 100%";
bodyBgs[2] = "135deg, #F97794 10%, #623AA2 100%";
bodyBgs[3] = "135deg, #FFF5C3 10%, #9452A5 100%";
bodyBgs[4] = "135deg, #FFF886 10%, #F072B6 100%";
bodyBgs[5] = "135deg, #FFA8A8 10%, #FCFF00 100%";
bodyBgs[6] = "135deg, #81FFEF 10%, #F067B4 100%";
bodyBgs[7] = "135deg, #FFCF71 10%, #2376DD 100%";
bodyBgs[8] = "135deg, #F0FF00 10%, #58CFFB 100%";
bodyBgs[9] = "135deg, #3C8CE7 10%, #00EAFF 100%";
bodyBgs[10] = "135deg, #C2FFD8 10%, #465EFB 100%";
bodyBgs[11] = "135deg, #FDD819 10%, #E80505 100%";
bodyBgs[12] = "135deg, #F05F57 10%, #360940 100%";
var randomBgIndex = Math.round( Math.random() * 12 );
d删除我ocument.write('<style>body{background-image:linear-gradient(' + bodyBgs[randomBgIndex] + ');}.slider{background-image:linear-gradient(' + bodyBgs[randomBgIndex] + ');}</style>');
渐变色是我自己选的,不太合胃口的可以去这里--coolhue 为设计渐变色而生的网站。
可以不止12种渐变色。增删后记得把* 12改了。