Skip to content
Snippets Groups Projects
Commit a01556b7 authored by HouTeng Chan's avatar HouTeng Chan
Browse files

Update 2 files

- /wiki/layout.html
- /wiki/pages/attributions.html
parent 77ce6720
No related branches found
No related tags found
No related merge requests found
...@@ -62,52 +62,63 @@ ...@@ -62,52 +62,63 @@
} }
.sidebar { .sidebar {
position: fixed; position: fixed;
left: 5px; left: 5px;
top: 210px; top: 210px;
width: 200px; width: 160px;
height: 60%; height: 40%;
background-color: #ffffff; background-color: #ffffff;
padding: 20px; padding: 20px;
box-shadow: 2px 0 5px rgba(0,0,0,0.1); box-shadow: 2px 0 5px rgba(0,0,0,0.1);
border-radius: 20px; border-radius: 20px;
} }
.sidebar ul { .sidebar ul {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; }
} .sidebar ul li a {
.sidebar ul li { display: block;
margin-bottom: 10px; padding: 10px;
position: relative; color: #fa8072;
} text-decoration: none;
.sidebar ul li a { transition: all 0.3s ease;
display: block; border-radius: 20px; /* Added border-radius here */
padding: 10px; }
color: #fa8072; .sidebar ul li a:hover {
text-decoration: none; background-color: #fa8072;
transition: all 0.3s ease; color: #ffffff;
border-radius: 20px; transform: translateY(-3px);
} box-shadow: 0 4px 8px rgba(0,0,0,0.1);
.sidebar ul li a:hover { }
background-color: #fa8072;
color: #ffffff; .progress-container {
transform: translateY(-3px); position: fixed;
box-shadow: 0 4px 8px rgba(0,0,0,0.1); left: 25px;
} bottom: 160px;
.progress-bar { width: 60px;
position: absolute; height: 60px;
left: 0; z-index: 1000;
top: 0; }
bottom: 0;
width: 4px; .progress-bar-circle {
background-color: #fa8072; transform: rotate(-90deg);
opacity: 0; }
transition: opacity 0.3s, height 0.3s;
} .progress-circle {
.sidebar ul li.active .progress-bar { stroke: hsl(17, 100%, 50%);
opacity: 1; stroke-linecap: round;
} transition: stroke-dashoffset 0.3s;
}
.progress-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 12px;
font-weight: bold;
color: hsl(17, 100%, 50%);
}
.back-to-top { .back-to-top {
position: fixed; position: fixed;
...@@ -195,33 +206,45 @@ ...@@ -195,33 +206,45 @@
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
const sidebarItems = document.querySelectorAll('.sidebar ul li'); var circle = document.querySelector('.progress-circle');
const sections = document.querySelectorAll('section'); var radius = circle.r.baseVal.value;
var circumference = radius * 2 * Math.PI;
function updateProgress() { var backToTopButton = document.getElementById('backToTop');
const scrollPosition = window.scrollY;
const windowHeight = window.innerHeight; circle.style.strokeDasharray = `${circumference} ${circumference}`;
const documentHeight = document.documentElement.scrollHeight; circle.style.strokeDashoffset = circumference;
sections.forEach((section, index) => { function setProgress(percent) {
const sectionTop = section.offsetTop; const offset = circumference - (percent / 100) * circumference;
const sectionHeight = section.offsetHeight; circle.style.strokeDashoffset = offset;
const sectionProgress = (scrollPosition - sectionTop + windowHeight/2) / sectionHeight; document.querySelector('.progress-text').textContent = Math.round(percent) + '%';
}
if (sectionProgress > 0 && sectionProgress <= 1) {
sidebarItems[index].classList.add('active'); function handleScroll() {
sidebarItems[index].querySelector('.progress-bar').style.height = `${sectionProgress * 100}%`; var winScroll = document.documentElement.scrollTop;
} else { var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
sidebarItems[index].classList.remove('active'); var scrolled = (winScroll / height) * 100;
sidebarItems[index].querySelector('.progress-bar').style.height = '0'; setProgress(scrolled);
}
}); // Show or hide the back to top button
} if (winScroll > 300) {
backToTopButton.classList.add('show');
window.addEventListener('scroll', updateProgress); } else {
updateProgress(); // Initial call to set the correct state on page load backToTopButton.classList.remove('show');
}
}
window.addEventListener('scroll', handleScroll);
// Back to top functionality
backToTopButton.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
}); });
});
</script> </script>
</body> </body>
</html> </html>
...@@ -36,13 +36,22 @@ ...@@ -36,13 +36,22 @@
{% block page_content %} {% block page_content %}
<div class="sidebar"> <div class="sidebar">
<ul> <ul>
<li><a href="#description">General Description<span class="progress-bar"></span></a></li> <li><a href="#description">General Description</a></li>
<li><a href="#topic1">Topic 1<span class="progress-bar"></span></a></li> <li><a href="#topic1">Topic1</a></li>
<li><a href="#topic2">Topic 2<span class="progress-bar"></span></a></li> <li><a href="#topic2">Topic2</a></li>
<li><a href="#topic3">Topic 3<span class="progress-bar"></span></a></li> <li><a href="#topic3">Topic3</a></li>
<li><a href="#topic4">Topic 4<span class="progress-bar"></span></a></li> <li><a href="#topic4">Topic4</a></li>
</ul> </ul>
</div> </div>
<div class="progress-container">
<svg class="progress-bar-circle" width="60" height="60">
<circle class="progress-circle" cx="30" cy="30" r="25" stroke-width="5" fill="transparent"></circle>
</svg>
<div class="progress-text">0%</div>
</div>
<button class="back-to-top" id="backToTop" title="Back to Top"></button>
<div class="row mt-4"> <div class="row mt-4">
<div class="col-lg-12"> <div class="col-lg-12">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment