Add animation, refactor
All checks were successful
Deploy new version of the application / Deploy Application (push) Successful in 2s
All checks were successful
Deploy new version of the application / Deploy Application (push) Successful in 2s
This commit is contained in:
29
index.html
29
index.html
@@ -29,6 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-listener"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-wrapper">
|
<div class="card-wrapper">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@@ -39,11 +40,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<p>Hello! I'm Erik Fehér, a passionate software developer with a knack for creating innovative solutions. With a background in computer science and years of experience in the tech industry, I specialize in building web applications that are both user-friendly and efficient. When I'm not coding, you can find me exploring the latest tech trends or contributing to open-source projects. Let's connect and create something amazing together!</p>
|
<div class="header">
|
||||||
|
<div class="brand">Erik Feher</div>
|
||||||
|
<img class="close" src="./public/next.svg"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-listener"></div>
|
||||||
|
</div>
|
||||||
<div class="card-wrapper">
|
<div class="card-wrapper">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img class="card-image" src="./public/cozy3.png"/>
|
<img class="card-image" src="./public/cozy3.png"/>
|
||||||
@@ -53,11 +57,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<p>Hello! I'm Erik Fehér, a passionate software developer with a knack for creating innovative solutions. With a background in computer science and years of experience in the tech industry, I specialize in building web applications that are both user-friendly and efficient. When I'm not coding, you can find me exploring the latest tech trends or contributing to open-source projects. Let's connect and create something amazing together!</p>
|
<div class="header">
|
||||||
|
<div class="brand">Erik Feher</div>
|
||||||
|
<img class="close" src="./public/next.svg"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-listener"></div>
|
||||||
|
</div>
|
||||||
<div class="card-wrapper">
|
<div class="card-wrapper">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img class="card-image" src="./public/cozy4.png"/>
|
<img class="card-image" src="./public/cozy4.png"/>
|
||||||
@@ -67,11 +74,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<p>Hello! I'm Erik Fehér, a passionate software developer with a knack for creating innovative solutions. With a background in computer science and years of experience in the tech industry, I specialize in building web applications that are both user-friendly and efficient. When I'm not coding, you can find me exploring the latest tech trends or contributing to open-source projects. Let's connect and create something amazing together!</p>
|
<div class="header">
|
||||||
|
<div class="brand">Erik Feher</div>
|
||||||
|
<img class="close" src="./public/next.svg"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-listener"></div>
|
||||||
|
</div>
|
||||||
<div class="card-wrapper">
|
<div class="card-wrapper">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<img class="card-image" src="./public/cozy5.png"/>
|
<img class="card-image" src="./public/cozy5.png"/>
|
||||||
@@ -81,11 +91,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content-container">
|
<div class="content-container">
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<p>Hello! I'm Erik Fehér, a passionate software developer with a knack for creating innovative solutions. With a background in computer science and years of experience in the tech industry, I specialize in building web applications that are both user-friendly and efficient. When I'm not coding, you can find me exploring the latest tech trends or contributing to open-source projects. Let's connect and create something amazing together!</p>
|
<div class="header">
|
||||||
|
<div class="brand">Erik Feher</div>
|
||||||
|
<img class="close" src="./public/next.svg"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="card-listener"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
<script src="script.js"></script>
|
<script src="script.js"></script>
|
||||||
|
|||||||
50
script.js
50
script.js
@@ -1,9 +1,14 @@
|
|||||||
function init() {
|
function init() {
|
||||||
const cards = document.getElementsByClassName('card-wrapper');
|
const cards = document.getElementsByClassName('card-wrapper');
|
||||||
|
|
||||||
console.log(cards[0]); // Logs the first card-wrapper elementű
|
|
||||||
for (let i = 0; i < cards.length; i++) {
|
for (let i = 0; i < cards.length; i++) {
|
||||||
cards[i].addEventListener('click', function() {
|
const cardListener = cards[i].getElementsByClassName('card-listener')[0];
|
||||||
|
cardListener.addEventListener('click', () => openCard(cards, i));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function openCard(cards, i) {
|
||||||
for (let j = 0; j < cards.length; j++) {
|
for (let j = 0; j < cards.length; j++) {
|
||||||
if (j === i) {
|
if (j === i) {
|
||||||
cards[j].classList.remove('hidden');
|
cards[j].classList.remove('hidden');
|
||||||
@@ -15,9 +20,6 @@ function init() {
|
|||||||
cards[j].classList.add('hidden');
|
cards[j].classList.add('hidden');
|
||||||
cards[j].classList.remove('active');
|
cards[j].classList.remove('active');
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInProgress() {
|
function addInProgress() {
|
||||||
@@ -32,5 +34,43 @@ function addInProgress() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextPage() {
|
||||||
|
const nextButtons = document.getElementsByClassName('close');
|
||||||
|
const cards = document.getElementsByClassName('card-wrapper');
|
||||||
|
|
||||||
|
for (let i = 0; i < nextButtons.length; i++) {
|
||||||
|
nextButtons[i].addEventListener('click', function() {
|
||||||
|
|
||||||
|
cards[(i+1) % nextButtons.length].classList.remove('hidden');
|
||||||
|
cards[(i+1) % nextButtons.length].classList.add('active');
|
||||||
|
cards[(i+1) % nextButtons.length].getElementsByClassName('content-wrapper')[0].classList.add('visible');
|
||||||
|
|
||||||
|
cards[i].getElementsByClassName('content-wrapper')[0].classList.remove('visible');
|
||||||
|
cards[i].classList.add('hidden');
|
||||||
|
cards[i].classList.remove('active');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function idle() {
|
||||||
|
let idleTime = 61;
|
||||||
|
const cards = document.getElementsByClassName('card-wrapper');
|
||||||
|
let cardIndex = 0;
|
||||||
|
setInterval(function() {
|
||||||
|
idleTime+=2;
|
||||||
|
if (idleTime > 1) {
|
||||||
|
openCard(cards, cardIndex++ % cards.length);
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
|
document.onclick = document.onm = function() {
|
||||||
|
console.log('User active, resetting idle timer.');
|
||||||
|
idleTime = 0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
addInProgress();
|
addInProgress();
|
||||||
init();
|
init();
|
||||||
|
nextPage();
|
||||||
|
idle();
|
||||||
15
styles.css
15
styles.css
@@ -12,6 +12,7 @@
|
|||||||
--base-content-background-color: #ffffff20;
|
--base-content-background-color: #ffffff20;
|
||||||
--content-wrap-padding: 16px;
|
--content-wrap-padding: 16px;
|
||||||
--header-margin-bottom: 20px;
|
--header-margin-bottom: 20px;
|
||||||
|
--content-container-height: calc(100dvh - (2 * var(--card-gap)));
|
||||||
|
|
||||||
font-family: "BBH Sans Bogle", sans-serif;
|
font-family: "BBH Sans Bogle", sans-serif;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -28,6 +29,20 @@ html, body {
|
|||||||
height: 100dvh;
|
height: 100dvh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-listener {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: var(--content-container-height);
|
||||||
|
top: calc(-1 * (100dvh - (2 * var(--card-gap))) - var(--label-height) - var(--content-container-height));
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active > .card-listener {
|
||||||
|
top: calc(-1 * (100dvh - (2 * var(--card-gap))) - var(--label-height) + 20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#container {
|
#container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|||||||
Reference in New Issue
Block a user