This repository was archived by the owner on Jan 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Expand file tree Collapse file tree 4 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ You can configure a few things by editing the file `src/config/index.tsx`.
23
23
- ` FILE_EXTENSION ` - The filetypes supported. Default ` png ` .
24
24
- ` FILE_MIME ` - The file mime type. Default ` image/png ` .
25
25
- ` SHOW_TITLE ` - If the title should be overlaid. Default ` false ` .
26
+ - ` DISABLE_SCROLL ` - Should the user be able to scroll? Default ` true ` .
26
27
- ` STACK_TRANSFORM ` - How the stack should be positioned on the page. Default shown below.
27
28
28
29
``` ts
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export const RETRY_INTERVAL = 10 * 1000;
5
5
export const FILE_EXTENSION = "png" ;
6
6
export const FILE_MIME = "image/png" ;
7
7
export const SHOW_TITLE = false ;
8
+ export const DISABLE_SCROLL = true ;
8
9
9
10
export const STACK_TRANSFORM = {
10
11
x : "100%" ,
Original file line number Diff line number Diff line change 1
- import { useRef } from "react" ;
1
+ import { useEffect , useRef } from "react" ;
2
2
3
3
import { useFullscreen } from "rooks" ;
4
4
import Head from "next/head" ;
5
5
import type { NextPage } from "next" ;
6
6
7
7
import useImages from "@/hooks/useImages" ;
8
- import { STACK_TRANSFORM } from "@/config" ;
8
+ import { DISABLE_SCROLL , STACK_TRANSFORM } from "@/config" ;
9
9
import { Positioner } from "@/components/Positioner" ;
10
10
import { ImageStack } from "@/components/ImageStack" ;
11
11
@@ -15,6 +15,16 @@ const Home: NextPage = () => {
15
15
const { toggleFullscreen } = useFullscreen ( {
16
16
target : fullscreenContainerRef ,
17
17
} ) ;
18
+
19
+ useEffect ( ( ) => {
20
+ if ( ! DISABLE_SCROLL ) return ;
21
+ const old = document . body . style . overflow ;
22
+ document . body . style . overflow = "hidden" ;
23
+ return ( ) => {
24
+ document . body . style . overflow = old ;
25
+ } ;
26
+ } , [ ] ) ;
27
+
18
28
return (
19
29
< >
20
30
< Head >
Original file line number Diff line number Diff line change 2
2
body {
3
3
padding : 0 ;
4
4
margin : 0 ;
5
- overflow : hidden;
6
5
}
7
6
8
7
body : fullscreen {
You can’t perform that action at this time.
0 commit comments