Files
METH_Transcendence/docker-compose/requirements/nginx/static/javascript/homePage/main.js
Misthaa 522f4f602a Site :
- Fix "REGISTER" to "Register"
    - Fix "NEWS" to "AUTHORS"
    - Fix Chat Button to icon (No notifications)
    - Fix not center title on login and register screen
2024-09-17 14:28:57 +02:00

58 lines
2.1 KiB
JavaScript

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.js :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marvin <marvin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/25 00:02:19 by edbernar #+# #+# */
/* Updated: 2024/09/17 13:06:30 by marvin ### ########.fr */
/* */
/* ************************************************************************** */
import { LiveChat } from "/static/javascript/liveChat/main.js";
import { Home3D } from "/static/javascript/home3D/home3D.js"
import { Login } from "/static/javascript/login/main.js";
class HomePage
{
static create()
{
Home3D.create();
Login.create();
LiveChat.create();
window.addEventListener('scroll', scrool);
window.addEventListener('bScroll', scrollToSection)
}
static dispose()
{
Home3D.dispose();
Login.dispose();
LiveChat.dispose();
window.removeEventListener('scroll', scrool);
window.removeEventListener('bScroll', scrollToSection)
}
};
function scrollToSection() {
document.querySelector('#homeSection relative').scrollIntoView({
behavior: 'smooth'
});
console.log("CACA");
}
function scrool()
{
const scrollPosition = window.scrollY;
const rotationAngle = scrollPosition * 0.1;
const parallaxElement = document.querySelector('#firstBall');
const parallaxElement2 = document.querySelector('#secondBall');
const parallaxSpeed = scrollPosition * -0.17;
parallaxElement.style.transform = `translateX(-50%) translateY(${-parallaxSpeed}px) rotate(${rotationAngle}deg)`;
parallaxElement2.style.transform = `translateX(50%) translateY(${-parallaxSpeed}px) rotate(${rotationAngle}deg)`;
}
export { HomePage };