Skip to content

Commit

Permalink
Merge pull request #2 from RecyLife/dev
Browse files Browse the repository at this point in the history
Merge dev
  • Loading branch information
AsteroidusTv authored Oct 17, 2024
2 parents 8f20210 + 4ff880c commit 51e3eab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion images/arrow.svg

This file was deleted.

File renamed without changes.
File renamed without changes
Binary file added images/favicons/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>RecyTech</title>
<link rel="icon" href="images/logo.png" type="image/png">
<link rel="icon" type="image/svg+xml" href="images/logo.svg">
<link rel="icon" href="images/favicon.ico" type="image/x-icon">
<link rel="icon" href="images/favicons/favicon.png" type="image/png">
<link rel="icon" href="images/favicons/favicon.svg" type="image/svg+xml">
<link rel="icon" href="images/favicons/favicon.ico" type="image/x-icon">

<link rel="stylesheet" href="./styles/styles.css">
<link rel="stylesheet" href="./styles/header.css">
Expand Down
34 changes: 18 additions & 16 deletions scripts/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Navigation - Smooth Scroll
// Smooth Scroll Functionality
function smoothScroll(linkId, targetId) {
const targetElement = document.getElementById(targetId);
let elementPosition = targetElement.getBoundingClientRect().top + window.pageYOffset;
Expand All @@ -11,7 +11,7 @@ function smoothScroll(linkId, targetId) {
});
}

// Hamburger menu
// Hamburger Menu Functionality
const body = document.body;
const header = document.getElementById("mainHeader");
const headerBackground = document.getElementById("headerBackground");
Expand All @@ -29,12 +29,12 @@ function toggleHamburgerMenu() {
hamburgerMenu.classList.toggle("active");

if (headerLinks.classList.contains("is-hamburger-active")) {
headerLink.forEach((el, index) => {
headerLink.forEach((el) => {
el.classList.add('is-hamburger-active');
body.style.overflow = "hidden"
body.style.overflow = "hidden";
});
} else {
body.style.overflow = "scroll"
body.style.overflow = "scroll";
headerLink.forEach(el => el.style.display = "none");
headerLink.forEach(el => el.classList.remove('is-hamburger-active'));
setTimeout(function() {
Expand All @@ -59,8 +59,9 @@ headerLink.forEach((link) => {
});
});

// Contact Form
document.getElementById('contactForm').addEventListener('submit', async function(event) {
// Contact Form Submission
const contactForm = document.getElementById('contactForm');
contactForm.addEventListener('submit', async function(event) {
event.preventDefault();

const email = document.getElementById('email').value.trim();
Expand All @@ -86,7 +87,12 @@ document.getElementById('contactForm').addEventListener('submit', async function

if (data === "true") {
sendButton.textContent = 'Envoyé';
document.getElementById('contactForm').reset();
contactForm.reset();

setTimeout(() => {
sendButton.disabled = false;
sendButton.textContent = 'Envoyer';
}, 2000);
} else {
throw new Error('Une erreur est survenue lors de l\'envoi du message.');
}
Expand All @@ -98,7 +104,7 @@ document.getElementById('contactForm').addEventListener('submit', async function
}
});

// Load
// Page Load Overlay Handling
window.addEventListener('load', () => {
const overlay = document.getElementById('overlay');
overlay.style.transition = 'opacity 0.5s ease';
Expand All @@ -112,7 +118,7 @@ window.addEventListener('load', () => {
console.log('%c[Loader] Page chargée sans erreurs!', 'color: green; font-weight: bold;');
});

// Crash Handling
// Global Error Handling and Reload
window.addEventListener('error', event => {
const overlay = document.getElementById('overlay');
overlay.style.display = 'flex';
Expand All @@ -135,12 +141,10 @@ Colonne: ${colno}
console.error('%c[Loader] Une erreur est survenue ! Reload de la page.', 'color: red; font-weight: bold;');
console.error(errorMsg);

// Empêche l'affichage de l'erreur dans la console du navigateur
event.preventDefault();
});


// On scroll animations
// Scroll Animation for Elements
document.addEventListener('DOMContentLoaded', () => {
const elements = [
document.getElementById("recycling"),
Expand All @@ -161,6 +165,4 @@ document.addEventListener('DOMContentLoaded', () => {
}
});
});
});


});

0 comments on commit 51e3eab

Please sign in to comment.