Permalink
Browse files

refactor: background image 背景图开关

  • Loading branch information...
MOxFIVE committed Oct 19, 2015
1 parent 77925bb commit f7ec8da43b5f7af91d834abc5a7f3b9cc5e9d423
Showing with 41 additions and 12 deletions.
  1. +14 −2 README.md
  2. +4 −1 _config.yml
  3. +1 −3 layout/_partial/after-footer.ejs
  4. +22 −0 layout/_partial/background.ejs
  5. +0 −6 source/js/main.js
View
@@ -67,6 +67,18 @@ hexo new page about
hexo new page tags
```
#### Background image 网页背景:
Change image list in: 修改背景图地址:
> `themes/yelee/layout/_partial/background.ejs`
Remove background image and use white-gray theme by:
取消网页背景图,使用淳朴的灰白主题
> `themes/yelee/_config.yml` - `background_image: false`
#### 404 Page:
```
@@ -97,7 +109,7 @@ Hide this via putting `original: false` to post's front-matter.
在文章顶部插入行 `original: false` 关闭文章版权声明框
#### RSS feed 文章订阅:
#### RSS Feed 文章订阅:
Install plugin: [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed)
@@ -107,7 +119,7 @@ Install plugin: [hexo-generator-seo-friendly-sitemap](https://github.com/ludovic
百度专用: [hexo-generator-baidu-sitemap](https://github.com/coneycode/hexo-generator-baidu-sitemap)
#### Apple touch icon 苹果图标:
#### Apple Touch icon 苹果图标:
替换路径: `/yelee/source/apple-touch-icon.png`
View
@@ -21,6 +21,9 @@ subnav:
rss: /atom.xml
# true: 个性图片背景, false: 淳朴灰白背景
background_image: true
# Content
excerpt_link: more
fancybox: true
@@ -67,4 +70,4 @@ aboutme: 专注于前端
#是否显示边栏中的搜索框
#Search Box in left column
#search_box: true
#search_box: true
@@ -17,10 +17,8 @@
</script>
<%- js('http://7.url.cn/edu/jslib/comb/require-2.1.6,jquery-1.9.1.min') %>
<%- js('js/main') %>
<%- partial('_partial/background') %>
<%- partial('google-analytics') %>
<% if (theme.mathjax){ %>
<%- partial('mathjax') %>
<% } %>
@@ -0,0 +1,22 @@
<% if (theme.background_image){ %>
<script type="text/javascript">
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)"];
var background = Math.floor(Math.random() * backgroundList.length);
$("body").css({"background": backgroundList[background], "background-attachment": "fixed", "background-size": "cover"});
</script>
<% } else { %>
<style type="text/css">
body {
background: lightgray;
}
#container .left-col {
background: white;
}
.article-inner {
background: white;
}
.post-nav-button {
background: #ececec;
}
</style>
<% } %>
View
@@ -114,10 +114,4 @@ require([], function (){
$("#container .left-col .overlay").css({"background-color": colorList[id],"opacity": .3});
//移动端
$("#container #mobile-nav .overlay").css({"background-color": colorList[id],"opacity": .7});
//随机背景图片
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)"];
var background = Math.floor(Math.random() * backgroundList.length);
$("body").css({"background": backgroundList[background], "background-attachment": "fixed", "background-size": "cover"});
});

0 comments on commit f7ec8da

Please sign in to comment.