Skip to content

Commit

Permalink
feat: random colour 随机背景色
Browse files Browse the repository at this point in the history
  • Loading branch information
MOxFIVE committed Sep 8, 2015
1 parent 3e5f553 commit 83b8e18
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion themes/Yilia/source/js/main.js
Expand Up @@ -106,5 +106,13 @@ require([], function (){
if(yiliaConfig.open_in_new == true){
$(".article a[href]").attr("target", "_blank")
}

//随机取颜色
//$(".left-col .overlay").css({"background-color": '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6),"opacity": 1});
//从给定的颜色值中选
var colorList = ["#6da336", "#ff945c", "#66CC66", "#99CC99", "#CC6666", "#76becc", "#c99979", "#918597", "#4d4d4d"];
var id = Math.ceil(Math.random()*(colorList.length-1));
//移动页面
$("#container #mobile-nav .overlay").css({"background-color": colorList[id],"opacity": 1});
//PC页面
$("#container .left-col .overlay").css({"background-color": colorList[id],"opacity": 1});
});

0 comments on commit 83b8e18

Please sign in to comment.