File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,16 @@ import { prefersReducedMotion } from "../utils/misc";
33
44let visible = false ;
55
6+ export function hide ( ) : void {
7+ $ ( ".scrollToTopButton" ) . addClass ( "invisible" ) ;
8+ visible = false ;
9+ }
10+
11+ function show ( ) : void {
12+ $ ( ".scrollToTopButton" ) . removeClass ( "invisible" ) ;
13+ visible = true ;
14+ }
15+
616$ ( document ) . on ( "click" , ".scrollToTopButton" , ( ) => {
717 $ ( ".scrollToTopButton" ) . addClass ( "invisible" ) ;
818 window . scrollTo ( {
@@ -17,10 +27,8 @@ $(window).on("scroll", () => {
1727
1828 const scroll = window . scrollY ;
1929 if ( ! visible && scroll > 100 ) {
20- $ ( ".scrollToTopButton" ) . removeClass ( "invisible" ) ;
21- visible = true ;
30+ show ( ) ;
2231 } else if ( visible && scroll < 100 ) {
23- $ ( ".scrollToTopButton" ) . addClass ( "invisible" ) ;
24- visible = false ;
32+ hide ( ) ;
2533 }
2634} ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { updateFooterAndVerticalAds } from "../controllers/ad-controller";
77import * as ModesNotice from "../elements/modes-notice" ;
88import * as Keymap from "../elements/keymap" ;
99import * as TestConfig from "../test/test-config" ;
10+ import * as ScrollToTop from "../elements/scroll-to-top" ;
1011
1112export const page = new Page ( {
1213 name : "test" ,
@@ -32,5 +33,6 @@ export const page = new Page({
3233 void TestConfig . instantUpdate ( ) ;
3334 void Funbox . activate ( ) ;
3435 void Keymap . refresh ( ) ;
36+ ScrollToTop . hide ( ) ;
3537 } ,
3638} ) ;
You can’t perform that action at this time.
0 commit comments