File tree 3 files changed +31
-2
lines changed
3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
+ - Show reading list title and reading list actions when scrolling up.
6
+
5
7
## 25.04.1
6
8
7
9
- Remove async functions to simplify the code.
Original file line number Diff line number Diff line change 173
173
window . addEventListener ( "scrollend" , runRefresh ) ;
174
174
} ;
175
175
176
+ const setupMobileScroll = ( ) => {
177
+ const headerHeight = getComputedStyle ( document . body ) . getPropertyValue (
178
+ "--content-header-height" ,
179
+ ) ;
180
+ const readingListTitleContainer = document . getElementById ( "reading-list-title-container" ) ;
181
+ readingListTitleContainer . style . top = headerHeight ;
182
+ const titleHeight = readingListTitleContainer . getBoundingClientRect ( ) . height ;
183
+ const readingListActionsContainer = document . getElementById ( "reading-list-actions-container" ) ;
184
+ readingListActionsContainer . style . top = `calc(${ headerHeight } + ${ titleHeight } px)` ;
185
+
186
+ let currentOffset = window . scrollY ;
187
+
188
+ window . addEventListener ( "scroll" , ( ) => {
189
+ if ( currentOffset > window . scrollY ) {
190
+ readingListTitleContainer . classList . add ( "sticky-top" ) ;
191
+ readingListActionsContainer . classList . add ( "sticky-top" ) ;
192
+ } else {
193
+ readingListTitleContainer . classList . remove ( "sticky-top" ) ;
194
+ readingListActionsContainer . classList . remove ( "sticky-top" ) ;
195
+ }
196
+
197
+ currentOffset = window . scrollY ;
198
+ } ) ;
199
+ } ;
200
+
176
201
window . addEventListener ( "load" , ( ) => {
177
202
jsCfg = JSON . parse ( document . head . querySelector ( "#js-cfg" ) . textContent ) ;
178
203
setupReadAction ( ) ;
179
204
setupReadOnScroll ( ) ;
180
205
setupRefresh ( ) ;
206
+ setupMobileScroll ( ) ;
181
207
} ) ;
182
208
} ) ( ) ;
Original file line number Diff line number Diff line change 53
53
</ div >
54
54
{% endblock center_navbar %}
55
55
{% block content %}
56
- < div class ="container-fluid px-md-3 ">
56
+ < div id ="reading-list-title-container "
57
+ class ="container-fluid px-md-3 bg-body z-1 ">
57
58
< div class ="row ">
58
59
< div class ="col col-md-3 d-none d-md-block "> </ div >
59
60
< div class ="col col-12 col-md-7 col-md-8 px-1 px-md-3 ">
@@ -70,7 +71,7 @@ <h1>{{ page_title }}</h1>
70
71
</ nav >
71
72
</ div >
72
73
< div class ="col col-12 col-md-8 px-1 px-md-3 mx-0 ">
73
- < div class ="row px-0 mx-0 ">
74
+ < div id =" reading-list-actions-container " class ="row px-0 mx-0 bg-body z-1 ">
74
75
{% if count_articles_of_current_reading_list > 0 %}
75
76
< h2 class ="fs-6 col-6 col-md-2 align-middle d-flex align-items-center px-0 mx-0 ">
76
77
< span id ="articles-in-total ">
You can’t perform that action at this time.
0 commit comments