From 5fa02a32cdecabe9b0d7049ab7589dfb0728a2a0 Mon Sep 17 00:00:00 2001 From: Kum1ta Date: Thu, 14 Nov 2024 16:55:03 +0100 Subject: [PATCH] Lobby page - add auto scroll when click on gamemode Profile page - fix some bug --- .../nginx/static/javascript/lobbyPage/main.js | 48 ++++++++++++++++--- .../static/javascript/profilPage/main.js | 9 ++-- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js index e0f0bdd..7d6b277 100644 --- a/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js +++ b/docker-compose/requirements/nginx/static/javascript/lobbyPage/main.js @@ -6,7 +6,7 @@ /* By: edbernar { + window.scroll({ + top: 100000, + behavior: 'smooth' + }); + }, 50); + } for (let i = 0; i < menuList.length; i++) { menuList[i].style.display = 'none'; @@ -239,11 +248,20 @@ function selectGameModeOne() gameMode = 0; } -function selectGameModeTwo() +function selectGameModeTwo(event, disableScroll = false) { const menuList = document.getElementsByClassName('menuSelected'); const gameModeDiv = document.getElementsByClassName('game-mode')[0].children; + if (!disableScroll) + { + setTimeout(() => { + window.scroll({ + top: 100000, + behavior: 'smooth' + }); + }, 50); + } for (let i = 0; i < menuList.length; i++) { menuList[i].style.display = 'none'; @@ -274,11 +292,20 @@ function selectGameModeTwo() gameMode = 1; } -function selectGameModeThree() +function selectGameModeThree(event, disableScroll = false) { const menuList = document.getElementsByClassName('menuSelected'); const gameModeDiv = document.getElementsByClassName('game-mode')[0].children; + if (!disableScroll) + { + setTimeout(() => { + window.scroll({ + top: 100000, + behavior: 'smooth' + }); + }, 50); + } for (let i = 0; i < menuList.length; i++) { menuList[i].style.display = 'none'; @@ -306,11 +333,20 @@ function selectGameModeThree() gameMode = 2; } -function selectGameModeFour() +function selectGameModeFour(event, disableScroll = false) { const menuList = document.getElementsByClassName('menuSelected'); const gameModeDiv = document.getElementsByClassName('game-mode')[0].children; + if (!disableScroll) + { + setTimeout(() => { + window.scroll({ + top: 100000, + behavior: 'smooth' + }); + }, 50); + } for (let i = 0; i < menuList.length; i++) { menuList[i].style.display = 'none'; diff --git a/docker-compose/requirements/nginx/static/javascript/profilPage/main.js b/docker-compose/requirements/nginx/static/javascript/profilPage/main.js index 31a3742..447f453 100644 --- a/docker-compose/requirements/nginx/static/javascript/profilPage/main.js +++ b/docker-compose/requirements/nginx/static/javascript/profilPage/main.js @@ -6,7 +6,7 @@ /* By: edbernar { const arrayBuffer = e.target.result;