Forked from
2024 Competition / Tsinghua
1217 commits behind the upstream repository.
-
HouTeng Chan authoredHouTeng Chan authored
menu.html 6.50 KiB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Bar</title>
<style>
body {
margin: 0;
font-family: 'Times New Roman', Times, serif;
background-color: #f0f0f0;
}
.my-nav {
background-color: rgba(255, 228, 225, 0.95);
padding: 10px 0;
position: fixed;
width: 100%;
top: 0;
left: 0;
z-index: 1000;
height: 50px;
border-bottom: 2px solid #fa8072;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
display: flex;
justify-content: center;
transition: all 0.3s ease;
}
.my-navbar {
list-style-type: none;
padding: 0;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.my-navbar > li {
position: relative;
margin: 0 15px;
}
.my-navbar > li > a {
color: #333;
text-decoration: none;
padding: 10px 15px;
display: block;
border-radius: 20px;
transition: all 0.3s ease;
font-weight: 500;
letter-spacing: 0.5px;
}
.my-navbar > li > a:hover,
.my-navbar > li > a.active {
background-color: #fa8072;
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(250, 128, 114, 0.3);
}
.son {
display: none;
position: absolute;
background-color: rgba(255, 255, 255, 0.95);
min-width: 200px;
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
z-index: 1;
opacity: 0;
transition: all 0.3s ease;
top: 100%;
border-radius: 10px;
overflow: hidden;
padding: 5px; /* Add some padding */
}
.son li {
margin: 5px 0;
}
.son li a {
color: #333;
padding: 12px 20px;
text-decoration: none;
display: block;
transition: all 0.3s ease;
white-space: nowrap;
border-radius: 20px;
}
.son li a:hover {
background-color: #fa8072;
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 10px rgba(250, 128, 114, 0.3);
}
@media (max-width: 768px) {
.my-nav {
height: auto;
padding: 10px;
}
.my-navbar {
flex-direction: column;
align-items: flex-start;
}
.my-navbar > li {
margin: 5px 0;
}
.logo-container {
position: static;
margin-bottom: 10px;
}
.navbar-logo {
height: 100px;
}
}
</style>
</head>
<body>
<nav class="my-nav" id="navbox">
<ul class="my-navbar" id="my-navbar">
<li><a href="{{ url_for('home') }}">Home</a></li>
<li onmouseover="over(this)" onmouseleave="leave(this)">
<a href="#" style="cursor:default;">Project</a>
<ul class="son">
<li><a href="{{ url_for('pages', page='description') }}">Description</a></li>
<li><a href="{{ url_for('pages', page='design') }}">Design</a></li>
<li><a href="{{ url_for('pages', page='engineering') }}">Engineer Success</a></li>
<li><a href="{{ url_for('pages', page='safety') }}">Safety</a></li>
<li><a href="{{ url_for('pages', page='contribution') }}">Contribution</a></li>
</ul>
</li>
<li onmouseover="over(this)" onmouseleave="leave(this)">
<a href="#" style="cursor:default;">Wetlab</a>
<ul class="son">
<li><a href="{{ url_for('pages', page='secretion') }}">Secretion</a></li>
<li><a href="{{ url_for('pages', page='colonization') }}">Colonization</a></li>
<li><a href="{{ url_for('pages', page='measurement') }}">Measurement</a></li>
</ul>
</li>
<li onmouseover="over(this)" onmouseleave="leave(this)">
<a href="#" style="cursor:default;">Drylab</a>
<ul class="son">
<li><a href="{{ url_for('pages', page='model') }}">Model</a></li>
<li><a href="{{ url_for('pages', page='software') }}">Software</a></li>
<li><a href="{{ url_for('pages', page='hardware') }}">Hardware</a></li>
</ul>
</li>
<li onmouseover="over(this)" onmouseleave="leave(this)">
<a href="#" style="cursor:default;">Human Practices</a>
<ul class="son">
<li><a href="{{ url_for('pages', page='human-practices') }}">Human Practices</a></li>
<li><a href="{{ url_for('pages', page='education') }}">Education</a></li>
<li><a href="{{ url_for('pages', page='inclusivity') }}">Inclusivity</a></li>
</ul>
</li>
<li onmouseover="over(this)" onmouseleave="leave(this)">
<a href="#" style="cursor:default;">Team</a>
<ul class="son">
<li><a href="{{ url_for('pages', page='team') }}">Roster</a></li>
<li><a href="{{ url_for('pages', page='attribution') }}">Attribution</a></li>
</ul>
</li>
</ul>
</nav>
<script>
function over(el){
el.children[0].classList.add('active');
if (el.children.length > 1){
let son = el.children[1];
if (getComputedStyle(son,null)["display"]=="none"){
son.style.display = "block";
setTimeout(function(){
son.style.opacity = 1;
}, 10);
}
}
}
function leave(el){
el.children[0].classList.remove('active');
if (el.children.length > 1){
let son = el.children[1];
if (getComputedStyle(son,null)["display"]=="block"){
son.style.opacity = 0;
setTimeout(function(){
son.style.display = "none";
}, 300);
}
}
}
</script>
</body>
</html>