File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -119,11 +119,11 @@ export function scroll2Top (offset = 0) {
119
119
}
120
120
121
121
export function sticky ( ) {
122
- const dom = document . querySelector ( 'section.cover' )
123
- const coverHeight = dom . getBoundingClientRect ( ) . height
122
+ sticky . dom = sticky . dom || document . querySelector ( 'section.cover' )
123
+ const coverHeight = sticky . dom . getBoundingClientRect ( ) . height
124
124
125
125
return ( function ( ) {
126
- if ( window . pageYOffset >= coverHeight || dom . classList . contains ( 'hidden' ) ) {
126
+ if ( window . pageYOffset >= coverHeight || sticky . dom . classList . contains ( 'hidden' ) ) {
127
127
document . body . classList . add ( 'sticky' )
128
128
sticky . noSticky = false
129
129
} else {
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ export function renderCover (content) {
154
154
return
155
155
}
156
156
renderCover . dom . classList . add ( 'show' )
157
- if ( renderCover . rendered ) return
157
+ if ( renderCover . rendered ) return event . sticky ( )
158
158
159
159
// render cover
160
160
let html = markdown ( content )
You can’t perform that action at this time.
0 commit comments