Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap">
<link rel="stylesheet" href="./style.css">
<script src="https://kit.fontawesome.com/4cf6385dfa.js" crossorigin="anonymous"></script>
<title>Eventica</title>
</head>

Expand Down Expand Up @@ -67,6 +68,10 @@ <h2 class="section-title">Upcoming Events</h2>
</div>
</div>
</section>

<a href="#" class="to-top">
<i class="fas fa-chevron-up"></i>
</a>
</main>

<footer class="footer">
Expand Down
20 changes: 20 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ function isEventPast(eventDate) {
return eventDateObj < todayUTC;
}

// Scroll to top button
const toTop = document.querySelector(".to-top");

window.addEventListener("scroll", checkHeight)
function checkHeight() {
if(window.scrollY > 100) {
toTop.classList.add("active");
}
else {
toTop.classList.remove("active");
}
}

toTop.addEventListener("click", function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});

// Function to create event cards
function createEventCard(event, isPastEvent = false) {
const buttonText = isPastEvent ? 'View Details' : 'Register';
Expand Down
29 changes: 29 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,35 @@ body {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.to-top {
background: white;
position: fixed;
bottom: 16px;
right: 32px;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
color: #1f1f1f;
text-decoration: none;
opacity: 0;
pointer-events:none;
transition: all .4s;
}

.to-top.active {
bottom: 32px;
pointer-events: auto;
opacity: 1;
}

html {
scroll-behavior: smooth;
}

/* Events Section Css */

.events {
Expand Down
Loading