Festalist.svelte
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<script>
import { fly } from 'svelte/transition'
import SideBar from './SideBar.svelte';
let show = true;
let sidebar_show = false;
function showBar() {
sidebar_show = !sidebar_show;
}
function hide() {
if (window.scrollY < 400) {
show = true
} else {
show = false
}
}
</script>
<style>
.sidebtn {
border-radius: 5px;
border: 0px;
width: 70px;
height: 70px;
position: fixed;
left: -20px;
top: 10%;
padding-right: 10px;
text-align: right;
background-color: #e65100;
color: #ffffff;
}
.sidebtn:focus {
background-color: #f57c00;
}
.sidebtn:hover {
background-color: #ef6c00;
}
</style>
<svelte:window on:scroll={hide}></svelte:window>
{#if (show)}
<button class="sidebtn"
transition:fly="{{ x : -50, duration : 400}}"
on:click={showBar}>
행사<br>목록
</button>
<SideBar bind:show={sidebar_show}>행사목록!</SideBar>
{/if}