File tree 2 files changed +6
-28
lines changed
2 files changed +6
-28
lines changed Original file line number Diff line number Diff line change 19
19
}
20
20
21
21
@media only screen {
22
- main {
23
- display : -webkit-box;
24
- display : -ms-flexbox;
25
- display : flex;
26
- }
27
-
28
22
@media (max-width : 1179px ) {
29
23
.sidebar-hidden # sidetoc {
30
24
display : none;
51
45
}
52
46
}
53
47
54
- .content-wrap {
55
- width : 100% ;
56
- }
57
-
58
48
# sidetoc {
59
- margin-top : 20px ;
60
- margin-left : 20px ;
61
- margin-right : auto;
49
+ margin-left : calc (100% + 20px );
62
50
}
63
51
# pagetoc {
64
52
position : fixed;
Original file line number Diff line number Diff line change @@ -72,28 +72,18 @@ function updatePageToc(elem = undefined) {
72
72
}
73
73
74
74
if ( document . getElementById ( "sidetoc" ) === null ) {
75
- // Element doesn't exist yet, let's create it
76
- const main = document . querySelector ( 'main' ) ;
77
- const wrapper = document . createElement ( 'div' ) ;
78
- wrapper . className = "content-wrap" ;
79
-
80
- // Move all children into the wrapper
81
- while ( main . firstChild ) {
82
- wrapper . appendChild ( main . firstChild ) ;
83
- }
84
-
85
- // Append the wrapper back to main
86
- main . appendChild ( wrapper ) ;
75
+ // The sidetoc element doesn't exist yet, let's create it
87
76
88
77
// Create the empty sidetoc and pagetoc elements
89
78
const sidetoc = document . createElement ( "div" ) ;
90
79
const pagetoc = document . createElement ( "div" ) ;
91
80
sidetoc . id = "sidetoc" ;
92
81
pagetoc . id = "pagetoc" ;
93
-
94
- // And append them to the current DOM
95
82
sidetoc . appendChild ( pagetoc ) ;
96
- main . appendChild ( sidetoc ) ;
83
+
84
+ // And append them to the current DOM
85
+ const main = document . querySelector ( 'main' ) ;
86
+ main . insertBefore ( sidetoc , main . firstChild ) ;
97
87
}
98
88
99
89
if ( document . getElementsByClassName ( "header" ) . length <= 1 ) {
You can’t perform that action at this time.
0 commit comments