Permalink
Browse files

add: background_image setting 背景图片设置

number value
  • Loading branch information...
MOxFIVE committed Nov 17, 2015
1 parent ded4e97 commit 51645e6fb0265df87b1ddab35a86a403bc4d5ede
Showing with 21 additions and 13 deletions.
  1. +13 −5 README.md
  2. +4 −2 _config.yml
  3. +4 −6 layout/_partial/background.ejs
View
@@ -73,15 +73,23 @@ hexo new page tags
#### 3. Background image 网页背景:
Change image list in: 修改背景图地址
Find or change background images in folder | 修改背景图地址:
> `themes/yelee/layout/_partial/background.ejs`
> `/yelee/source/background/`
Remove background image and use white-gray theme by:
Setting in `themes/yelee/_config.yml` 背景参数:
取消网页背景图,使用淳朴的灰白主题
`
background_image: 5
`
> `themes/yelee/_config.yml` - `background_image: false`
- Default value is 5, free to modify the number | 默认值为5,可按需修改
- "5": show 5 images form bg-1.jpg to bg-5.jpg in `/yelee/source/background/`
- "5": 设置`/yelee/source/background/`文件夹中 bg-1.jpg 到 bg-5.jpg 这5张图片为背景
- "0": remove background image and use white-gray theme | 取消网页背景图,使用淳朴的灰白主题
#### 4. Style image 自定义图片样式:
In order to style posts/pages' image with HTML/CSS within `.md` files, you should disable fancybox function firstly.
View
@@ -31,8 +31,10 @@ subnav:
# Customize feed link 自定义订阅地址
rss: /atom.xml
# true: 个性图片背景, false: 淳朴灰白背景
background_image: true
# "5": show images form bg-1.jpg to bg-5.jpg in `/yelee/source/background/`
# "5": 显示`/yelee/source/background/`文件夹中 bg-1.jpg 到 bg-5.jpg 这5张图片
# "0": white-gray background | 淳朴灰白背景
background_image: 5
# Content
excerpt_link: more
@@ -1,14 +1,12 @@
<% if (theme.background_image){ %>
<script type="text/javascript">
var backgroundnum = 10;
<script>
var backgroundnum = <%= theme.background_image %>;
var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
$("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
</script>
<% } else { %>
<style type="text/css">
<style>
body {
background: lightgray;
}
@@ -25,4 +23,4 @@
background-color: #bfd3ec;
}
</style>
<% } %>
<% } %>

0 comments on commit 51645e6

Please sign in to comment.