File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,12 @@ <h1>Ice Star</h1>
135135 < script src ="index.js?v=8 "> </ script >
136136< script >
137137window . addEventListener ( "load" , ( ) => {
138- const anchor = document . getElementById ( "jump_scroll" ) ;
138+ // If the splash is inside an iframe, target its document instead of window
139+ const iframe = document . getElementById ( "rk-frame-splash" ) ; // adjust to your splash iframe id
140+ const doc = iframe ? iframe . contentWindow : window ;
141+
142+ const anchor = ( iframe ? iframe . contentDocument . getElementById ( "jump_scroll" )
143+ : document . getElementById ( "jump_scroll" ) ) ;
139144 if ( ! anchor ) return ;
140145
141146 anchor . scrollIntoView ( {
@@ -147,28 +152,33 @@ <h1>Ice Star</h1>
147152 let sameCount = 0 ;
148153
149154 function trackScroll ( ) {
150- const currentPos = window . scrollY ;
155+ const currentPos = doc . scrollY ;
151156
152157 if ( currentPos === lastPos ) {
153158 sameCount ++ ;
154159 if ( sameCount >= 3 ) {
155- window . scrollBy ( {
160+ doc . scrollBy ( {
156161 top : 140 ,
157162 behavior : "smooth"
158163 } ) ;
159- return ;
164+ sameCount = 0 ; // reset so it keeps nudging until bottom
160165 }
161166 } else {
162167 sameCount = 0 ;
163168 }
164169
165170 lastPos = currentPos ;
166- requestAnimationFrame ( trackScroll ) ;
171+
172+ // keep tracking until we reach the bottom
173+ if ( currentPos + doc . innerHeight < doc . document . body . scrollHeight ) {
174+ requestAnimationFrame ( trackScroll ) ;
175+ }
167176 }
168177
169178 requestAnimationFrame ( trackScroll ) ;
170179} ) ;
171180</ script >
172181
182+
173183</ body >
174184</ html >
You can’t perform that action at this time.
0 commit comments