Skip to content
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
16 changes: 16 additions & 0 deletions css/faq.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
--color-events: #e30162;
}

#scrollUpButton {
position: fixed;
bottom: 40px;
right: 20px;
background-color: #007BFF;
color: #ffffff;
border: none;
border-radius: 50%;
width: 40px;
height: 40px;
cursor: pointer;
z-index: 9999;
}



.dark-theme {
--color-bg: #1c1b22;
--color-text: #e1e1ec;
Expand Down
4 changes: 4 additions & 0 deletions faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ <h3 class="question">
</section>
</main>

<button id="scrollUpButton" onclick="scrollToTop()">Top</button>


<footer>
<p class="info-repo">
The contents of this website are deployed from this
Expand All @@ -260,5 +263,6 @@ <h3 class="question">
<script type="text/javascript" src="./js/login.js"></script>
<script type="text/javascript" src="./js/navbar.js"></script>
<script src="js/darkmode.js"></script>

</body>
</html>
38 changes: 38 additions & 0 deletions js/faq.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const faqLinks = document.querySelectorAll('.faq_link');
const currentLocation = window.location.hash;




// to open accordian by pressing spacebar
window.addEventListener('keydown', (e) => {
const ancTag = document.querySelector(
Expand All @@ -12,6 +15,41 @@ window.addEventListener('keydown', (e) => {
}
});


// JavaScript (faq.js)

// JavaScript (faq.js)

// Function to smoothly scroll to the top of the page when the button is clicked
document.getElementById('scrollUpButton').addEventListener('click', function () {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});

// Show the scroll-up button when the user scrolls down the page
window.addEventListener('scroll', function () {
var scrollButton = document.getElementById('scrollUpButton');
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
scrollButton.style.display = 'block';
} else {
scrollButton.style.display = 'none';
}
});


// Initially hide the button when the page loads
document.addEventListener('DOMContentLoaded', function () {
var scrollButton = document.getElementById('scrollUpButton');
scrollButton.style.display = 'none';
});






// for adding tabindex=-1 to other faqlinks so that others faqlinks can't be accessed by tab
const removeFocusForOthers = (target) => {
faqLinks.forEach((faqLink) => {
Expand Down