Skip to content

Commit 5bff632

Browse files
modified: _layouts/default.html
modified: css/main.css new file: script/script.js
1 parent 5bade0e commit 5bff632

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

_layouts/default.html

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<meta name="viewport" content="width=device-width">
88
<link rel="icon" type="image/x-icon" href="/images/logo.png"/>
99
<link rel="stylesheet" href="/css/main.css">
10+
<script src="/script/script.js" defer></script>
1011
<link rel="alternate" type="application/rss+xml" title="RSS" href="/feed.xml">
1112
</head>
1213

css/main.css

+27-5
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,32 @@ body {
3535
-webkit-box-flex: 1;
3636
-webkit-flex: 1;
3737
-ms-flex: 1;
38-
flex: 1;
3938
max-width: 700px;
4039
}
4140

4241
.navbar {
4342
float: left;
43+
position: sticky;
44+
top: 0;
45+
overflow-y: scroll;
4446
text-align: left;
4547
width: 15em;
4648
padding: 2em;
47-
padding-right: 0;
49+
}
50+
51+
.navbar > ul {
52+
margin: 0;
53+
list-style: none;
54+
position: relative;
55+
line-height: 0;
56+
}
57+
58+
.navbar > ul > li {
59+
margin: .5rem 0;
60+
}
61+
62+
.navbar > ul > li.active {
63+
font-weight: bold;
4864
}
4965

5066
#menuLinkBar {
@@ -64,6 +80,9 @@ body {
6480
display: -ms-flexbox;
6581
display: flex;
6682
margin: 0 auto;
83+
max-height: 100vh;
84+
overflow-x: hidden;
85+
overflow-y: scroll;
6786
justify-content: center;
6887
}
6988

@@ -74,19 +93,22 @@ body {
7493
-webkit-flex-direction: column;
7594
-ms-flex-direction: column;
7695
flex-direction: column;
96+
max-height: fit-content;
7797
}
7898
.site {
7999
-webkit-box-ordinal-group: 3;
80100
-webkit-order: 2;
81101
-ms-flex-order: 2;
82102
order: 2;
103+
padding: 1em;
83104
}
84105
.navbar {
85-
width: auto;
106+
width: 100%;
86107
-webkit-box-ordinal-group:4;
87108
-webkit-order:3;
88109
-ms-flex-order:3;
89110
order:3;
111+
padding: 1em;
90112
}
91113
#menuLinkBar {
92114
display: block;
@@ -795,10 +817,10 @@ pre {
795817
-moz-border-radius: 3px;
796818
-ms-border-radius: 3px;
797819
-o-border-radius: 3px;
820+
white-space: pre-wrap;
798821
border-radius: 3px;
799822
display: block;
800823
padding: 10px 15px 13px 15px;
801-
margin: 0 3em 1em 3em;
802824
background-color: #fff;
803825
border: solid 1px #efeee6;
804826
line-height: 18px;
@@ -2015,7 +2037,7 @@ th, td {
20152037
}
20162038

20172039
img {
2018-
max-width: 100%;
2040+
max-width: 50%;
20192041
}
20202042

20212043
/* Table of contents */

script/script.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const NAVBAR_LI_ELEMENTS = document.getElementById('navbar').firstElementChild.children; // Access all the <li> in side navigation
2+
let flag = false;
3+
4+
5+
// rotate the arrow of <li> which matches the SITE_URL
6+
Array.from(NAVBAR_LI_ELEMENTS).forEach((liElement) => {
7+
if (liElement.firstElementChild.href == location.href) {
8+
liElement.classList.add('active');
9+
flag = true;
10+
return;
11+
}
12+
})
13+
14+
// if non of other is active the the Home tab is active
15+
if (!flag) NAVBAR_LI_ELEMENTS[0].classList.add('active');

0 commit comments

Comments
 (0)