Skip to content

Commit 14d2c95

Browse files
committed
Beginning work on side scrolling emoticons
1 parent 9a79091 commit 14d2c95

File tree

3 files changed

+118
-14
lines changed

3 files changed

+118
-14
lines changed

src/components/AboutMeComponents/FullPage.vue

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,31 @@
22

33
<template>
44
<div class="fullpage-container" @wheel="handleScroll">
5-
<div
6-
class="section"
7-
v-for="(section, index) in sections"
8-
:key="section.id"
9-
:ref="`section-${index}`"
10-
:class="`section-${index}`"
11-
>
5+
<div class="section" v-for="(section, index) in sections" :key="section.id" :ref="`section-${index}`"
6+
:class="`section-${index}`">
7+
<div class="sidescroll-container">
8+
<transition name="fade" @before-leave="beforeLeave">
9+
<SideScrolling v-if="index === 0 && activeSection === 0" />
10+
</transition>
11+
</div>
1212
<h2 class="content">{{ section.title }}</h2>
1313
<p class="content">{{ section.content }}</p>
1414
</div>
1515
<div class="scroll-indicator" v-if="showIndicator">
16-
<button v-for="(section, index) in sections" :key="index" @click="scrollToSection(index)">
16+
<div class="button-container" v-for="(section, index) in sections" :key="index" @click="scrollToSection(index)">
17+
<div class="box"></div>
1718
{{ section.title }}
18-
</button>
19+
</div>
1920
</div>
2021
</div>
2122
</template>
2223

2324
<script>
24-
import AshEffect from './AshEffect.vue';
25+
import SideScrolling from './SideScrolling.vue';
2526
2627
export default {
2728
components: {
29+
SideScrolling,
2830
},
2931
props: {
3032
sections: {
@@ -40,6 +42,7 @@ export default {
4042
return {
4143
activeSection: 0,
4244
isScrolling: false,
45+
isLeaving: false
4346
};
4447
},
4548
methods: {
@@ -58,7 +61,7 @@ export default {
5861
if (this.isScrolling) return;
5962
6063
this.isScrolling = true;
61-
64+
6265
const direction = event.deltaY > 0 ? 1 : -1;
6366
this.activeSection += direction;
6467
@@ -68,7 +71,7 @@ export default {
6871
this.activeSection = this.sections.length - 1;
6972
}
7073
setTimeout(() => {
71-
this.scrollToSection(this.activeSection);
74+
this.scrollToSection(this.activeSection);
7275
}, 100);
7376
7477
},
@@ -84,6 +87,13 @@ export default {
8487
section.style.backgroundImage = this.computeGradient(index, this.sections.length);
8588
}
8689
});
90+
},
91+
beforeLeave(el) {
92+
// Add a delay before the component is removed
93+
setTimeout(() => {
94+
// This will trigger the actual removal
95+
el.style.opacity = 0;
96+
}, 500); // Delay in milliseconds (500ms in this example)
8797
}
8898
},
8999
mounted() {
@@ -96,6 +106,19 @@ export default {
96106
</script>
97107

98108
<style scoped>
109+
.box{
110+
border: solid black 5px;
111+
padding: 5px;
112+
background-color:white;
113+
}
114+
115+
.fade-enter-active, .fade-leave-active {
116+
transition: opacity 0.5s ease;
117+
}
118+
.fade-enter, .fade-leave-to {
119+
opacity: 0;
120+
}
121+
99122
.fullpage-container {
100123
overflow: hidden;
101124
height: 100vh;
@@ -107,6 +130,8 @@ export default {
107130
display: flex;
108131
align-items: center;
109132
justify-content: center;
133+
flex-wrap: wrap;
134+
flex-direction:column;
110135
}
111136
112137
.section:nth-child(1) .content {
@@ -122,11 +147,28 @@ export default {
122147
right: 10px;
123148
top: 50%;
124149
transform: translateY(-50%);
125-
display: flex;
150+
display:inline-block;
126151
flex-direction: column;
152+
margin: 0px;
127153
}
128154
129155
.scroll-indicator button {
130156
margin-bottom: 10px;
131157
}
158+
159+
.button-container{
160+
display: flex;
161+
flex-direction:row;
162+
background:red;
163+
}
164+
165+
.sidescroll-container {
166+
background-color:green;
167+
color:white;
168+
align-items: center;
169+
justify-content: center;
170+
display:flex;
171+
flex-wrap: nowrap;
172+
width: 80%;
173+
}
132174
</style>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<template>
2+
<div id="scroll-container">
3+
4+
<div id="scroll-text">This is scrolling text.</div>
5+
</div>
6+
7+
8+
</template>
9+
10+
<script>
11+
export default {
12+
13+
}
14+
15+
16+
</script>
17+
18+
<style>
19+
#scroll-container {
20+
border: 3px solid black;
21+
border-radius: 5px;
22+
overflow: hidden;
23+
flex-direction:column;
24+
width: 100%;
25+
}
26+
27+
#scroll-text {
28+
/* animation properties */
29+
-moz-transform: translateX(100%);
30+
-webkit-transform: translateX(100%);
31+
transform: translateX(100%);
32+
33+
-moz-animation: my-animation 15s linear infinite;
34+
-webkit-animation: my-animation 15s linear infinite;
35+
animation: my-animation 15s linear infinite;
36+
}
37+
38+
/* for Firefox */
39+
@-moz-keyframes my-animation {
40+
from { -moz-transform: translateX(100%); }
41+
to { -moz-transform: translateX(-100%); }
42+
}
43+
44+
/* for Chrome */
45+
@-webkit-keyframes my-animation {
46+
from { -webkit-transform: translateX(100%); }
47+
to { -webkit-transform: translateX(-100%); }
48+
}
49+
50+
@keyframes my-animation {
51+
from {
52+
-moz-transform: translateX(100%);
53+
-webkit-transform: translateX(100%);
54+
transform: translateX(100%);
55+
}
56+
to {
57+
-moz-transform: translateX(-100%);
58+
-webkit-transform: translateX(-100%);
59+
transform: translateX(-100%);
60+
}
61+
}
62+
</style>

src/views/AboutMe.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template class="page">
2-
<AshEffect />
32
<div>
3+
<AshEffect />
44
<FullPage :sections="sections" :showIndicator="true" />
55
</div>
66
</template>

0 commit comments

Comments
 (0)