Skip to content

Commit 5fcbc95

Browse files
committed
封面优化&文章分页导航显示优化
1 parent 5d41769 commit 5fcbc95

File tree

7 files changed

+28
-33
lines changed

7 files changed

+28
-33
lines changed

_layouts/post.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ <h1>{{ page.title }}</h1>
2121
</div>
2222
{% if page.cover %}
2323
<div class="filter"></div>
24-
<div class="post-cover">
25-
<img id="postCover" src="{{ page.cover }}" alt="">
26-
</div>
24+
<div class="post-cover" style="background: url('{{ page.cover }}') center no-repeat; background-size: cover;">
2725
{% endif %}
28-
2926
</header>
3027

3128
<div class="post-content">

_posts/2017-04-18-new-theme-h2o.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ tags: jekyll 前端开发 设计
2828

2929
## 新特性
3030

31+
### 主题配色
32+
33+
支持两种主题配色——蓝色和粉色。
34+
35+
![](https://github.com/kaeyleo/jekyll-theme-H2O/blob/master/assets/img/jekyll-theme-h2o-themecolor.jpg?raw=true)
36+
3137
### 侧边栏
3238

3339
相比自己上一个版本的博客主题,首页增加侧边栏,可以展示博主简介和推荐标签(默认12个,可以在 ```_config.yml``` 文件里的 ```recommend-condition-size``` 处修改显示标签的最大个数)。
@@ -90,7 +96,7 @@ tags: jekyll 前端开发 设计
9096
- Go
9197
- Python
9298
93-
### 评论功能
99+
### 第三方评论
94100
95101
由于多说关闭,又对国内其他第三方评论插件无感,所以将[Disqus](https://disqus.com/)列为首选(目前模板也只提供了这个),请自备梯子。
96102
@@ -108,18 +114,14 @@ H2O在这方面还有很多需要完善的地方,比如:<strike>代码高亮
108114
109115
### 其他特性:
110116
111-
- 增加了网页标题SEO优化
112-
113-
- 支持两种主题颜色蓝色(默认)和粉色,可以在 ```_config.yml``` 文件里的 ```theme-color``` 处根据注释选择配置。主要效果体现在顶部导航栏的logo和鼠标悬停时文字显示的颜色效果。
114-
115-
- 自定义文章封面
116-
117+
- 网页标题SEO优化
117118
- 标签索引,点击标签跳转到标签目录,即可查看对应的全部文章
118-
119-
- 支持Disqus评论系统
119+
- 漂亮
120+
- 好看
121+
- 美
120122
121123
## 最后
122124
123125
本想趁这次机会将整站https化的,但折腾了半天发现弹性web托管并不支持,所以暂时搁置https的想法。另外,博客统计工具一直使用的是[百度统计](https://tongji.baidu.com),这次新增了Google Analytics。
124126
125-
H2O主题从0到1,独自设计、开发再到发布大约用了一周时间,也算完成一个小小的开源项目了,后续也将持续完善和更新。
127+
这次从0到1,独自设计、开发再到发布大约用了一周时间,也算完成一个小小的开源项目了,后续也将持续完善和更新,欢迎[Star](https://github.com/kaeyleo/jekyll-theme-H2O)

assets/css/app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev/js/index.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $(document).ready(function(){
8383
containerWidth = container.width(),
8484
imgHeight = img.height(),
8585
containerHeight = container.height();
86-
86+
var isOk = false;
8787
if(imgHeight < containerHeight) {
8888
img.css({
8989
'width': 'auto',
@@ -93,27 +93,26 @@ $(document).ready(function(){
9393
containerWidth = container.width();
9494
var marginLeft = (imgWidth - containerWidth) / 2;
9595
img.css('margin-left', '-' + marginLeft + 'px');
96+
isOk = true;
9697
} else {
9798
var marginTop = (containerHeight - imgHeight) / 2;
9899
img.css('margin-top', marginTop + 'px');
100+
isOk = true;
99101
}
100102

101-
setTimeout(function(){
102-
img.css({
103-
'transition': '.6s',
104-
'opacity': '1'
105-
});
106-
}, 0);
107-
103+
if(isOk) {
104+
img.fadeIn();
105+
isOk = false;
106+
}
108107
}
109108

110-
postCover($('#postCover'), $('.g-banner'));
111-
109+
// 文章分页导航
112110
$('.read-next-item section').each(function(){
113111
var _this = $(this),
114112
n = _this.height(),
115113
rn = $('.read-next-item').height();
116114
_this.css('margin-top', (rn-n)/2 + 'px');
115+
_this.fadeIn();
117116
});
118117

119118
$('.read-next-item img').each(function(){

dev/sass/app.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,6 @@ a {
481481
width: 100%;
482482
height: 100%;
483483
z-index: -2; }
484-
.post-header .post-cover img {
485-
opacity: 0;
486-
width: 100%; }
487484

488485
.bgcolor-default {
489486
background-color: #1494FB; }
@@ -603,6 +600,7 @@ a {
603600
height: 100%;
604601
z-index: 3; }
605602
.read-next-item section {
603+
display: none;
606604
position: relative;
607605
width: 80%;
608606
margin-left: 10%;
@@ -628,6 +626,7 @@ a {
628626
z-index: 1;
629627
transition: .3s linear; }
630628
.read-next-item img {
629+
display: none;
631630
position: absolute;
632631
top: 0;
633632
left: 0;

dev/sass/common.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,6 @@
383383
width: 100%;
384384
height: 100%;
385385
z-index: -2;
386-
img {
387-
opacity: 0;
388-
width: 100%;
389-
}
390386
}
391387
}
392388

@@ -534,6 +530,7 @@
534530
z-index: 3;
535531
}
536532
section {
533+
display: none;
537534
position: relative;
538535
width: 80%;
539536
margin-left: 10%;
@@ -563,6 +560,7 @@
563560
transition: .3s linear;
564561
}
565562
img {
563+
display: none;
566564
position: absolute;
567565
top: 0;
568566
left: 0;

0 commit comments

Comments
 (0)