Skip to content

Commit

Permalink
Added "back to top" to all pages where it was missing
Browse files Browse the repository at this point in the history
  • Loading branch information
swathivemula7 committed Oct 20, 2024
1 parent c0981b5 commit 2249e7a
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 23 deletions.
6 changes: 5 additions & 1 deletion Blog_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ <h2>Exploring creative fields</h2>
</div>
<span>Creative Canvas Blog Page</span>
</footer>

<!-- Back to Top Button -->
<button id="BacktoTop">
<span></span>
</button>
<script src="src/Scripts/BacktoTop.js"></script>
<script>
// Coordinates for the cursor
const coords = { x: 0, y: 0 };
Expand Down
6 changes: 6 additions & 0 deletions about-us.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,13 @@ <h3 class="mb-4">Join Our Community</h3>
| All rights reserved © 2024
</p>
</div>
<!-- Back to Top Button -->
<button id="BacktoTop">
<span></span>
</button>

</section>
<script src="src/Scripts/BacktoTop.js"></script>
<script>
var typed = new Typed("#site-name", {
strings: ["Canvas Editor", "Build and shine!"],
Expand Down
22 changes: 1 addition & 21 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -840,27 +840,7 @@ <h3>Thank You!</h3>
</section>

<script src="src\Scripts\preloader.js"></script>
<script>
const scrollToTopBtn = document.getElementById("BacktoTop");
window.onscroll = function () {
scrollFunction();
};

function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
scrollToTopBtn.style.visibility = 'visible';
scrollToTopBtn.style.opacity = '1';
} else {
scrollToTopBtn.style.visibility = 'hidden';
scrollToTopBtn.style.opacity = '0';
}
}

scrollToTopBtn.addEventListener("click", function () {
// Smooth scroll back to top
window.scrollTo({ top: 0, behavior: 'smooth' });
});
</script>
<script src="src/Scripts/BacktoTop.js"></script>

<script>
document.addEventListener('DOMContentLoaded', function () {
Expand Down
4 changes: 4 additions & 0 deletions privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ <h3 class="mb-4">Join Our Community</h3>
| All rights reserved © 2024
</p>
</div>
<button id="BacktoTop">
<span></span>
</button>
</section>
<script src="src/Scripts/BacktoTop.js"></script>
<script>
var typed = new Typed("#site-name", {
strings: ["Canvas Editor", "Build and shine!"],
Expand Down
29 changes: 29 additions & 0 deletions review.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,31 @@
background: #1c47e3;
border: 5px double;
}
/* Back to Top Button */
#BacktoTop {
position: fixed; /* Stay in fixed position */
bottom: 50px; /* Positioned above the chatbot */
right: 5px; /* Aligned to the right */
width: 55px;
height: 55px;
background-color: #007bff; /* Button background */
color: white; /* Text color */
padding: 10px 15px; /* Padding for button size */
border-radius: 50%; /* Circular button */
border: none;
font-size: 24px; /* Size of the text or arrow */
font-weight: bolder;
display: block; /* Initially hidden */
visibility: hidden;
z-index: 1000; /* Ensures it is above most elements */
cursor: pointer; /* Pointer when hovered */
}

#BacktoTop:hover {
background-color: #0056b3; /* Change to a lighter blue on hover */
transform: scale(1.1);
}

</style>
<style>
/* Circle styles */
Expand Down Expand Up @@ -354,7 +379,11 @@ <h5>Text <i class="fa-solid fa-text-width"></i></h5>
</div>
<!-- Copyright -->
</footer>
<button id="BacktoTop">
<span></span>
</button>
</div>
<script src="src/Scripts/BacktoTop.js"></script>
<script>
// Coordinates for the cursor
const coords = { x: 0, y: 0 };
Expand Down
19 changes: 19 additions & 0 deletions src/Scripts/BacktoTop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const scrollToTopBtn = document.getElementById("BacktoTop");
window.onscroll = function () {
scrollFunction();
};

function scrollFunction() {
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
scrollToTopBtn.style.visibility = 'visible';
scrollToTopBtn.style.opacity = '1';
} else {
scrollToTopBtn.style.visibility = 'hidden';
scrollToTopBtn.style.opacity = '0';
}
}

scrollToTopBtn.addEventListener("click", function () {
// Smooth scroll back to top
window.scrollTo({ top: 0, behavior: 'smooth' });
});
26 changes: 26 additions & 0 deletions src/Styles/Style_Blog_page.css
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,32 @@ footer{
letter-spacing: 2px;
}

/* Back to Top Button */
#BacktoTop {
position: fixed; /* Stay in fixed position */
bottom: 50px; /* Positioned above the chatbot */
right: 5px; /* Aligned to the right */
width: 55px;
height: 55px;
background-color: #007bff; /* Button background */
color: white; /* Text color */
padding: 10px 15px; /* Padding for button size */
border-radius: 50%; /* Circular button */
border: none;
font-size: 24px; /* Size of the text or arrow */
font-weight: bolder;
display: block; /* Initially hidden */
visibility: hidden;
z-index: 1000; /* Ensures it is above most elements */
cursor: pointer; /* Pointer when hovered */
}

#BacktoTop:hover {
background-color: #0056b3; /* Change to a lighter blue on hover */
transform: scale(1.1);
}


/* Media Queries */
@media screen and (min-width: 540px){
.navbar-nav a{
Expand Down
33 changes: 32 additions & 1 deletion testimonial.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,31 @@
header {
position: relative; /* Add this to ensure proper positioning of the home button */
}
/* Back to Top Button */
#BacktoTop {
position: fixed; /* Stay in fixed position */
bottom: 50px; /* Positioned above the chatbot */
right: 5px; /* Aligned to the right */
width: 55px;
height: 55px;
background-color: #007bff; /* Button background */
color: white; /* Text color */
padding: 10px 15px; /* Padding for button size */
border-radius: 50%; /* Circular button */
border: none;
font-size: 24px; /* Size of the text or arrow */
font-weight: bolder;
display: block; /* Initially hidden */
visibility: hidden;
z-index: 1000; /* Ensures it is above most elements */
cursor: pointer; /* Pointer when hovered */
}

#BacktoTop:hover {
background-color: #0056b3; /* Change to a lighter blue on hover */
transform: scale(1.1);
}

</style>
</head>
<body>
Expand Down Expand Up @@ -286,13 +311,19 @@ <h3>Endless Customization</h3>
<p>Flexible tools that allow you to bring your unique vision to life.</p>
</div>
</div>
</section>
<!-- Back to Top Button -->
<button id="BacktoTop">
<span></span>
</button>
</section>

<div class="cta">
<h2>Ready to unleash your creativity?</h2>
<p>Join thousands of satisfied users and start designing today!</p>
<a href="index.html#mainCanvas" class="cta-button">Start Drawing Now ➡ </a>
</div>
</div>

<script src="src/Scripts/BacktoTop.js"></script>
</body>
</html>

0 comments on commit 2249e7a

Please sign in to comment.