diff --git a/css/style.css b/css/style.css
index 6c7c48d..eefa658 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1956,7 +1956,7 @@ button:hover {
#backToTopBtn {
position: fixed;
- bottom: 130px;
+ bottom: 50px;
right: 31px;
height: 50px;
width: 50px;
@@ -1969,7 +1969,7 @@ button:hover {
border-radius: 50%;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: 500ms;
- display: none; /* Initially hide the button */
+ display: none;
justify-content: center;
align-items: center;
z-index: 9999;
@@ -1981,7 +1981,9 @@ button:hover {
transform: scale(1.05);
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}
-
+.indexpage #backToTopBtn {
+ bottom: 130px;
+}
.header {
margin-top: 100px;
diff --git a/index.html b/index.html
index ab80793..2b344f2 100644
--- a/index.html
+++ b/index.html
@@ -156,7 +156,9 @@
-
+
diff --git a/js/backToTopBtn.js b/js/backToTopBtn.js
index 707d924..ead20cd 100644
--- a/js/backToTopBtn.js
+++ b/js/backToTopBtn.js
@@ -1,22 +1,24 @@
+document.addEventListener("DOMContentLoaded", function () {
+ const backToTopButton = document.getElementById('backToTopBtn');
-let backToTopBtn = document.getElementById("backToTopBtn");
+ window.addEventListener('scroll', handleScroll);
+ handleScroll();
-window.onscroll = function() {
- scrollFunction();
-};
-
-function scrollFunction() {
- if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) {
- backToTopBtn.style.display = "block";
- } else {
- backToTopBtn.style.display = "none";
+ function handleScroll() {
+ if (window.scrollY === 0) {
+ backToTopButton.classList.add('disabled');
+ backToTopButton.style.display = 'none'; // Hide button at top
+ } else {
+ backToTopButton.classList.remove('disabled');
+ backToTopButton.style.display = 'block'; // Show button when scrolling
+ }
}
-}
+ window.startSimulation = function() {
+ backToTopButton.style.display = 'none';
+ }
-backToTopBtn.addEventListener("click", function() {
- window.scrollTo({
- top: 0,
- behavior: 'smooth'
- });
+ window.backToTop = function () {
+ window.scrollTo({ top: 0, behavior: 'smooth' });
+ }
});
diff --git a/js/script.js b/js/script.js
index e760e58..d65d91a 100644
--- a/js/script.js
+++ b/js/script.js
@@ -885,16 +885,16 @@ function effect() {
loader.style.display = "none";
document.querySelector(".unload").style.display = "block";
document.querySelector(".snowflakes").style.display = "block";
- var backToTopBtn = document.getElementById("backToTopBtn");
- backToTopBtn.style.display = "block";
+ // var backToTopBtn = document.getElementById("backToTopBtn");
+ // backToTopBtn.style.display = "block";
}
var loader = document.querySelector(".loader");
window.addEventListener('load', () => {
- var backToTopBtn = document.getElementById("backToTopBtn");
- backToTopBtn.style.display = "none";
+ // var backToTopBtn = document.getElementById("backToTopBtn");
+ // backToTopBtn.style.display = "none";
setTimeout(effect, 4000);
})
@@ -904,26 +904,26 @@ function changeColor() {
}
document.addEventListener("DOMContentLoaded", function () {
- var backToTopBtn = document.getElementById("backToTopBtn");
- backToTopBtn.style.display = "block";
- backToTopBtn.addEventListener("click", function () {
- scrollToTop();
- scrollToForm();
- });
-
- function scrollToTop() {
- window.scrollTo({
- top: 0,
- behavior: "smooth"
- });
- }
- function scrollToForm() {
- const formElement = document.getElementById("box");
- formElement.scrollTo({
- top: 0,
- behavior: "smooth"
- });
- }
+ // var backToTopBtn = document.getElementById("backToTopBtn");
+ // backToTopBtn.style.display = "block";
+ // backToTopBtn.addEventListener("click", function () {
+ // scrollToTop();
+ // scrollToForm();
+ // });
+
+ // function scrollToTop() {
+ // window.scrollTo({
+ // top: 0,
+ // behavior: "smooth"
+ // });
+ // }
+ // function scrollToForm() {
+ // const formElement = document.getElementById("box");
+ // formElement.scrollTo({
+ // top: 0,
+ // behavior: "smooth"
+ // });
+ // }
document.querySelector("#reload").addEventListener("click", () => {
window.location.reload();
diff --git a/pages/about.html b/pages/about.html
index d96549e..ce60862 100644
--- a/pages/about.html
+++ b/pages/about.html
@@ -58,33 +58,6 @@
}
}
- #backToTopBtn {
- position: fixed;
- bottom: 50px;
- right: 31px;
- height: 50px;
- width: 50px;
- padding: 10px 15px;
- font-size: 20px;
- cursor: pointer;
- border: none;
- background: linear-gradient(#1845ad, #23a2f6);
- color: white;
- border-radius: 50%;
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
- transition: 500ms;
- display: none; /* Initially hide the button */
- justify-content: center;
- align-items: center;
- z-index: 9999;
-}
-
-#backToTopBtn:hover {
- background: linear-gradient(to right, #ff512f, #f09819);
- opacity: 1;
- transform: scale(1.05);
- box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
-}
@@ -130,7 +103,7 @@
const circles = document.querySelectorAll(".circle");
circles.forEach(function (circle) {
- circle.x = 0;
+ circle.x = 0;
circle.y = 0;
});
@@ -163,8 +136,8 @@
});
-
-
+
+