This commit is contained in:
Mateusz Pstrucha committed 2020-11-19 20:53:11 +01:00
1 parent e5ab047820
commit c26c51d747
3 files changed
+19 -39

No files matched your search

+4 -4
View File
@@ -20,9 +20,9 @@
<span id="logoText"><span>M</span>a<span>t</span>eusz <span>P</span><span>s</span>trucha</span>
<div id="butts">
<div data-target="about" class="butt active">About me</div>
<div data-target="contact" class="butt">Projects</div>
<div data-target="more" class="butt">Index</div>
<div data-target="about" class="button active">About me</div>
<div data-target="projects" class="button">Projects</div>
<div data-target="more" class="button">Index</div>
<div style="clear: both"></div>
</div>
@@ -819,7 +819,7 @@
</div>
</div>
<div class="pane" id="contact">
<div class="pane" id="projects">
contact
</div>
+10 -18
View File
@@ -4,8 +4,8 @@ const Panes = {
switch(target) {
if (target == this.active) return
this.active = target
document.querySelector('.butt.active').classList.remove('active')
document.querySelector(`.butt[data-target=${target}]`).classList.add('active')
document.querySelector('.button.active').classList.remove('active')
document.querySelector(`.button[data-target=${target}]`).classList.add('active')
},
scrollTo(target){
clearTimeout(this.scrollTimeout)
@@ -17,35 +17,27 @@ const Panes = {
}
window.onload = function () {
// nav buttons handler
document.querySelector('#nav').onclick = function (e) {
let target = e.target.getAttribute('data-target')
if (target) {
// location.href = `#${target}`
// clearTimeout(scrollTimeout)
// document.querySelector(`#${target}`).scrollIntoView({
// behavior: 'smooth'
// })
// Panes.switch(target)
Panes.scrollTo(target)
}
}
var scrollTimeout,
wrapper = document.querySelector('.wrapper')
wrapper.addEventListener('scroll', function (e) {
let x = wrapper.scrollTop / window.innerHeight,
// scroll handler
document.querySelector('.wrapper').addEventListener('scroll', function (e) {
let x = this.scrollTop / window.innerHeight,
y = Math.floor(x + .5)
clearTimeout(scrollTimeout)
scrollTimeout = setTimeout(function () {
Panes.scrollTo(['about', 'contact', 'more'][y])
// Panes.switch(['about', 'contact', 'more'][y])
clearTimeout(Panes.scrollTimeout)
Panes.scrollTimeout = setTimeout(function () {
Panes.scrollTo(document.querySelector('.panes').children[y].id)
}, 200)
});
// initial typewriter animation
document.querySelectorAll('.typein').forEach(typein => {
var target = typein.getAttribute('data-content')
function print(index) {
+5 -17
View File
@@ -12,18 +12,6 @@ body {
overflow: hidden;
}
@keyframes fader {
0% {
stroke-width: 0px;
}
50% {
stroke-width: 10px;
}
0% {
stroke-width: 0px;
}
}
@keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: white; }
@@ -46,7 +34,6 @@ body {
background-color: var(--color-main);
}
.wrapper {
width: 100vw;
height: 100vh;
@@ -121,18 +108,18 @@ body {
float: right;
}
#butts>.butt {
.button {
float: left;
padding: .5rem 1rem;
cursor: pointer;
text-align: center;
}
#butts>.butt.active {
.button.active {
border-bottom: 2px solid var(--color-main);
}
#butts>.butt:hover {
.button:hover {
background: #ffffff0f;
}
@@ -141,7 +128,7 @@ body {
display: flex;
width: 100%;
}
#butts>.butt {
#butts>.button {
width: 100%;
}
.pane {
@@ -199,6 +186,7 @@ body {
white-space: nowrap;
overflow: hidden;
display: inline-block;
padding-right: 5px;
border-right: 3px solid white;
animation: