Permalink
Browse files

feat: random background image 随机背景图片

  • Loading branch information...
MOxFIVE committed Oct 6, 2015
1 parent be92a30 commit 086578b4bc2b8d57c2d729baf32c203380dc3c80
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -101,18 +101,23 @@ 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});
//$("#container .left-col .overlay").css({"background-color": '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6),"opacity": .15});
//$("#container #mobile-nav .overlay").css({"background-color": '#'+('00000'+(Math.random()*0x1000000<<0).toString(16)).slice(-6),"opacity": .6});
//从给定的颜色值中选
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": .7});
//PC页面
$("#container .left-col .overlay").css({"background-color": colorList[id],"opacity": .3});
//随机背景图片
var backgroundList = ["url(/background/bg-1.jpg)", "url(/background/bg-2.jpg)","url(/background/bg-3.jpg)","url(/background/bg-4.jpg)","url(/background/bg-5.jpg)","url(/background/bg-6.jpg)","url(/background/bg-7.jpg)","url(/background/bg-8.jpg)","url(/background/bg-9.jpg)","url(/background/bg-10.jpg)","url(/background/bg-11.jpg)","url(/background/bg-12.jpg)","url(/background/bg-13.jpg)","url(/background/bg-14.jpg)","url(/background/bg-15.jpg)","url(/background/bg-16.jpg)","url(/background/bg-17.jpg)","url(/background/bg-18.jpg)"];
var background = Math.floor(Math.random() * backgroundList.length);
$("body").css({"background": backgroundList[background], "background-attachment": "fixed", "background-size": "cover"});
});
Binary file not shown.

0 comments on commit 086578b

Please sign in to comment.