Permalink
Browse files

feat: random colour 随机背景色

from:
iblogc/hexo-theme-yilia@2be5bc0
6f1de6b918a9e365c4800
  • Loading branch information...
MOxFIVE committed Sep 8, 2015
1 parent 3e5f553 commit 83b8e18c74608768e4de9f62afbec617637356f9
Showing with 9 additions and 1 deletion.
  1. +9 −1 themes/Yilia/source/js/main.js
@@ -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.