File tree Expand file tree Collapse file tree 2 files changed +35
-5
lines changed Expand file tree Collapse file tree 2 files changed +35
-5
lines changed Original file line number Diff line number Diff line change 1
- <svg viewBox =" 0 0 1440 500" xmlns =" http://www.w3.org/2000/svg" preserveAspectRatio =" none" >
1
+ <script >
2
+ export let bottom = 0 ;
3
+ </script >
4
+
5
+ <svg
6
+ viewBox =" 0 0 1440 500"
7
+ xmlns =" http://www.w3.org/2000/svg"
8
+ preserveAspectRatio =" none"
9
+ style ="bottom: {- bottom }; height: {bottom / 5 + 35 }vh"
10
+ >
2
11
<path class =" wave" />
3
12
</svg >
4
13
5
14
<style >
6
15
svg {
16
+ transition : height 1s var (--bezier-one );
7
17
position : absolute ;
8
18
z-index : -999 ;
9
- bottom : 0 ;
10
- height : 35vh ;
11
19
width : 100% ;
12
20
}
13
21
Original file line number Diff line number Diff line change 5
5
import Wave from ' $lib/components/Wave.svelte' ;
6
6
import Footer from ' $layout/Footer/FooterHost.svelte' ;
7
7
import Head from ' $lib/components/Head.svelte' ;
8
+ import { onMount } from ' svelte' ;
8
9
9
10
let scrollY = 0 ;
10
11
let footerVisible = false ;
11
12
12
- $: footerVisible = scrollY >= 10 ;
13
+ // temporary fix until rewrite is out
14
+ function checkVisibility () {
15
+ if (scrollY === 0 ) return (footerVisible = false );
16
+
17
+ const el = document .querySelector (' #skiptab > main > div.hide-on-scroll.s-y_bCXRrkrYfP > div' );
18
+ const buffer = 24 ; // 1.5rem gap
19
+
20
+ if (! el) return (footerVisible = scrollY >= 24 );
21
+
22
+ const rect = el .getBoundingClientRect ();
23
+ footerVisible = rect .bottom + buffer <= window .innerHeight ;
24
+ }
25
+
26
+ onMount (() => {
27
+ window .addEventListener (' scroll' , checkVisibility, { passive: true });
28
+ window .addEventListener (' resize' , checkVisibility);
29
+
30
+ return () => {
31
+ window .removeEventListener (' scroll' , checkVisibility);
32
+ window .removeEventListener (' resize' , checkVisibility);
33
+ };
34
+ });
13
35
</script >
14
36
15
37
<svelte:window bind:scrollY />
133
155
</div >
134
156
</div >
135
157
<div class ="hide-on-scroll" class:hidden ={footerVisible }>
136
- <Wave />
158
+ <Wave bottom ={ scrollY } />
137
159
<SocialHost />
138
160
</div >
139
161
</main >
You can’t perform that action at this time.
0 commit comments