Skip to content

Commit 9cc0efb

Browse files
committed
feat: 头部固定采用sticky
2 parents d49f73a + 616b0ff commit 9cc0efb

11 files changed

+23
-20
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ V、主题开源,唯一支持作者的方式是下方打赏[支付宝/微信]
5454
I、wordPress主题制作有独特规范,如主题根目录必须存在header.php、index.php、footer.php、style.css,否则主题视为"不完整",无法安装。
5555
因此不用觉得某些文件不合理,存在即有意义
5656

57-
II、为了用户最佳浏览体验,该主题对≤IE8作了屏蔽跳转,≥IE9版本可能无法完整展示CSS3效果,但会尽量兼容到不影响阅读
57+
II、```v2.9.0后不再对IE支持```,如需兼容IE9及以上可下载之前老版本
5858

5959
III、CSS文件基于终端做分割,因此你会看到主题目录dist > css文件夹中有style-pc.css、style-ios.css、style-ipd.css三个文件,没错,三端样式完全独立不重用,不过你完全不用过分担心,打包后多端样式会合并压缩到style_min.css,代价没你想象的那么大,有利有弊,不予置评
6060

dist/Art_Blog/css/style_min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Art_Blog/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33

44
<head>
5-
<meta name='generator' content='WordPress/Art_Blog v2022-05-29 20:35:05'>
5+
<meta name='generator' content='WordPress/Art_Blog v2022-05-29 22:25:13'>
66
<title><?php $name = wp_title( '-', true, 'right' );
77
if ($name) {
88
echo $name . "&nbsp;-&nbsp;" . get_bloginfo('description');

dist/Art_Blog/js/main_min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/Art_Blog/page-time.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
html{height:auto;}
1414
body{background-image:-webkit-linear-gradient(180deg, #FFFEF9, #EED6CC);background-image:linear-gradient(180deg,#FFFEF9,#EED6CC);}
1515
a:hover{text-decoration: underline;}
16-
#message{width:1200px;margin:80px auto 45px;overflow:hidden;padding:0 50px;}
16+
#message{width:1200px;margin:0 auto 45px;overflow:hidden;padding:0 50px;}
1717
#header{ background:#fff; border-radius:5px; line-height:48px; font-size:16px; font-weight:bold; box-shadow:0 5px 7px rgba(0,0,0,0.2); color:#ed145b;}
1818
#footer{ height:30px; border-radius:5px; line-height:30px; text-align:center; position:relative;z-index:10; margin-top:40px}
1919
#footer a,#footer p{ display:inline-block;}

src/css/style-ios.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@
711711

712712
.continar {
713713
width: 100%;
714-
margin: 1rem auto 0 !important;
714+
margin: 0 auto;
715715
-webkit-transition: -webkit-transform 0.25s;
716716
transition: -webkit-transform 0.25s;
717717
transition: transform 0.25s;
@@ -3101,7 +3101,7 @@
31013101
background: var(--color-theme);
31023102
line-height: 1rem;
31033103
text-align: center;
3104-
position: fixed;
3104+
position: sticky;
31053105
top: 0;
31063106
left: 0;
31073107
z-index: 97;

src/css/style-ipd.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@
691691
.continar {
692692
width: 100%;
693693
height: calc(100% - 1rem);
694-
margin: 1.2rem auto 0 !important;
694+
margin: 0 auto;
695695
overflow: hidden;
696696
}
697697

@@ -3091,7 +3091,7 @@
30913091
background: var(--color-theme);
30923092
background-size: 100% 100%;
30933093
text-align: center;
3094-
position: absolute;
3094+
position: sticky;
30953095
top: 0;
30963096
left: 0;
30973097
z-index: 97;

src/css/style-pc.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
}
4848

4949
body {
50+
width: 100%;
51+
overflow-x: hidden;
5052
background: #f6f6f6;
5153
-webkit-font-smoothing: antialiased;
5254
-moz-osx-font-smoothing: grayscale;
@@ -57,9 +59,7 @@
5759
background-position-x: 0;
5860
background-position-y: 0;
5961
background-size: auto auto;
60-
overflow-x: hidden;
6162
border-top: 1px solid transparent;
62-
width: 100%;
6363
禁止文字选中
6464
-webkit-user-select: none;
6565
-moz-user-select: none;
@@ -418,7 +418,7 @@
418418
#js_banner {
419419
width: 100%;
420420
height: 300px;
421-
margin: 78px auto 0px;
421+
margin: 0 auto;
422422
z-index: 10;
423423
}
424424

@@ -434,10 +434,10 @@
434434
width: 100%;
435435
height: 64px;
436436
will-change: height;
437-
position: fixed;
437+
position: sticky;
438438
top: 0;
439439
left: 0;
440-
margin-bottom: 20px;
440+
margin-bottom: 15px;
441441
opacity: 1;
442442
z-index: 10;
443443
-webkit-transition: all 0.3s;
@@ -1454,7 +1454,7 @@
14541454
/* 主题内容区域start */
14551455
.continar {
14561456
width: 1200px;
1457-
margin: 86px auto 25px;
1457+
margin: 0 auto 25px;
14581458
min-height: calc(100% - 247px);
14591459
overflow: hidden;
14601460
}

src/index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33

44
<head>
5-
<meta name='generator' content='WordPress/Art_Blog v2022-05-29 20:35:05'>
5+
<meta name='generator' content='WordPress/Art_Blog v2022-05-29 22:25:13'>
66
<title><?php $name = wp_title( '-', true, 'right' );
77
if ($name) {
88
echo $name . "&nbsp;-&nbsp;" . get_bloginfo('description');

src/js/main.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@
503503
$('body,html').animate({
504504
scrollTop: 0
505505
}, 1200);
506+
$header.css("z-index", "10");
506507
$aircraft.animate({
507508
"top": "0",
508509
"bottom": "auto",
@@ -582,10 +583,12 @@
582583
}
583584
if ($scrollTop <= 0) {
584585
$header.addClass("Top")
585-
$header.removeClass("hover")
586+
$header.removeClass("hover");
587+
$header.css("z-index", "10");
586588
} else {
587-
$header.removeClass("Top")
588-
$header.addClass("hover")
589+
$header.removeClass("Top");
590+
$header.addClass("hover");
591+
$header.css("z-index", "12");
589592
}
590593
// 侧边栏域跟随
591594
if ($(window).width() > 1200 && $roll_obj.length) {

src/page-time.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
html{height:auto;}
1414
body{background-image:-webkit-linear-gradient(180deg, #FFFEF9, #EED6CC);background-image:linear-gradient(180deg,#FFFEF9,#EED6CC);}
1515
a:hover{text-decoration: underline;}
16-
#message{width:1200px;margin:80px auto 45px;overflow:hidden;padding:0 50px;}
16+
#message{width:1200px;margin:0 auto 45px;overflow:hidden;padding:0 50px;}
1717
#header{ background:#fff; border-radius:5px; line-height:48px; font-size:16px; font-weight:bold; box-shadow:0 5px 7px rgba(0,0,0,0.2); color:#ed145b;}
1818
#footer{ height:30px; border-radius:5px; line-height:30px; text-align:center; position:relative;z-index:10; margin-top:40px}
1919
#footer a,#footer p{ display:inline-block;}

0 commit comments

Comments
 (0)