File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
core/pfe-core/controllers Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -35,18 +35,20 @@ export class ScrollSpyController implements ReactiveController {
3535 static #instances = new Set < ScrollSpyController > ;
3636
3737 static {
38- addEventListener ( 'scroll' , ( ) => {
39- if ( Math . round ( window . innerHeight + window . scrollY ) >= document . body . scrollHeight ) {
38+ if ( isServer ) {
39+ addEventListener ( 'scroll' , ( ) => {
40+ if ( Math . round ( window . innerHeight + window . scrollY ) >= document . body . scrollHeight ) {
41+ this . #instances. forEach ( ssc => {
42+ ssc . #setActive( ssc . #linkChildren. at ( - 1 ) ) ;
43+ } ) ;
44+ }
45+ } , { passive : true } ) ;
46+ addEventListener ( 'hashchange' , ( ) => {
4047 this . #instances. forEach ( ssc => {
41- ssc . #setActive ( ssc . #linkChildren . at ( - 1 ) ) ;
48+ ssc . #activateHash ( ) ;
4249 } ) ;
43- }
44- } , { passive : true } ) ;
45- addEventListener ( 'hashchange' , ( ) => {
46- this . #instances. forEach ( ssc => {
47- ssc . #activateHash( ) ;
4850 } ) ;
49- } ) ;
51+ }
5052 }
5153
5254 #tagNames: string [ ] ;
You can’t perform that action at this time.
0 commit comments