Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hover effect added #152

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 39 additions & 15 deletions dashbboard.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
// Back-Top Button
document.addEventListener("scroll", function() {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
document.addEventListener("DOMContentLoaded", function() {
// Cache the back-to-top button element
const backToTopButton = document.querySelector(".back-to-top");

// show/hide back to top button based on scroll position
if (scrollTop > 50) {
document.body.classList.add("scroll-down");
} else {
document.body.classList.remove("scroll-down");
// Function to scroll to the top with smooth behavior
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: "smooth"
});
}
});

// Function to scroll to the top when the button is clicked
function scrollToTop() {
window.scrollTo({
top: 0,
behavior: "smooth"
// Function to handle scroll event with throttling
function handleScroll() {
const scrollTop = window.scrollY || document.documentElement.scrollTop;
if (scrollTop > 50) {
backToTopButton.classList.add("visible");
} else {
backToTopButton.classList.remove("visible");
}
}

// Throttle the scroll event listener
let throttleTimeout;
function throttleScroll() {
if (!throttleTimeout) {
throttleTimeout = setTimeout(function() {
throttleTimeout = null;
handleScroll();
}, 200); // Adjust the throttle interval as needed
}
}

// Event listener for scrolling
window.addEventListener("scroll", throttleScroll);

// Event listener for clicking back-to-top button
backToTopButton.addEventListener("click", function() {
scrollToTop();
// Add focus to an element after scrolling to improve accessibility
document.querySelector("h1").focus(); // Example: focus on the page heading
});
}
});

4 changes: 4 additions & 0 deletions dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ li:not(:first-child) {
position: absolute;
left: 100%;
transform: translate(-67%, -16.7vh);
cursor: pointer;
}

.foot {
Expand All @@ -83,6 +84,7 @@ main {
color: #72D34F;
cursor: default;
animation: fadeIn 1s ease-in-out;
text-align: center;
}

.grid {
Expand Down Expand Up @@ -309,6 +311,7 @@ h1 {
left: 100%;
transform: translate(-40%, -16.7vh);
}

li:not(:first-child) {
display: none;
}
Expand Down Expand Up @@ -356,3 +359,4 @@ body.scroll-down .back-to-top {
}



2 changes: 1 addition & 1 deletion dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<nav data-aos="fade-down" data-aos-duration="1000" >
<ul>
<li><img src="img/logo.png" alt="logo" class="logo"></li>
<li><a href="index.html"><img class="logo" atl="logo"src="img/logo.png"></li></a>
<li><a href="#app">Applications</a></li>
<li><a href="#book">Books</a></li>
<li><a href="#org">Organizations</a></li>
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1 class="space" data-aos="fade-left" data-aos-duration="1000">Space</h1>

<!--------------------------------------------------------------------- ENTRY BUTTON ---------------------------------------------------------------->
<div class="button">
<button><a href="dashboard.html">Find your Space</a></button>
<button><a href="dashboard.html">FIND YOUR SPACE</a></button>
</div>
<!-- aos script -->
<script src="https://unpkg.com/aos@next/dist/aos.js"></script>
Expand Down
9 changes: 5 additions & 4 deletions style-landing.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ button {
width: 250px;
height: 55px;
border: none;
border-radius: 12px;
border-radius: 120px;
color: white;
font-size: 18px; /* Adjusted font size */
font-weight: 700;
Expand All @@ -119,13 +119,14 @@ button {
}

button:hover {
width: 275px;
width: 270px;
height: 60px;
background-color: #4aaf3a; /* Adjusted hover color */
border-radius: 16px;
border-radius: 120px;
}

button a {
text-decoration: none;
color: white;
}
}