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

Update file human-practices.html

parent 5e677c72
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Expert Card - Li Peng</title>
<style>
body {
font-family: Calibri, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
}
.row {
display: flex;
flex-wrap: wrap;
}
.col-lg-12 {
width: 100%;
padding: 15px;
}
.expert-card {
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
overflow: hidden;
transition: box-shadow 0.3s ease;
}
.expert-card:hover {
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.col-md-3, .col-md-9 {
padding: 15px;
}
.expert-image {
width: 100%;
max-width: 200px;
height: auto;
border-radius: 8px;
}
.expert-name {
font-size: 1.5rem;
font-weight: bold;
color: #333;
}
.expert-role {
font-size: 1.1rem;
color: #666;
}
.expert-takeaway {
background-color: #f9f9f9;
padding: 15px;
border-radius: 8px;
margin-top: 15px;
}
.expert-content {
display: none;
padding: 15px;
background-color: #fff;
border-top: 1px solid #eee;
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.toggle-btn {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 0 0 8px 8px;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.3s ease;
}
.toggle-btn:hover {
background-color: #0056b3;
}
</style>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="https://static.igem.wiki/teams/5187/art/icon.png">
<title>Tsinghua - IGEM 2024</title>
<style>
body {
font-family: Calibri, sans-serif;
line-height: 1.6;
margin: 0;
padding: 20px;
background-color: #f4f4f4;
}
.expert-card {
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
transition: box-shadow 0.3s ease, transform 0.3s ease;
overflow: hidden;
}
.expert-card:hover {
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
transform: translateY(-5px);
}
.expert-image {
width: 100%;
max-width: 200px;
height: auto;
border-radius: 8px;
transition: transform 0.3s ease;
}
.expert-card:hover .expert-image {
transform: scale(1.05);
}
.expert-name {
font-size: 1.5rem;
font-weight: bold;
color: #333;
margin-bottom: 5px;
}
.expert-role {
font-size: 1.1rem;
color: #666;
display: block;
margin-bottom: 10px;
}
.expert-takeaway {
background-color: #f9f9f9;
padding: 15px;
border-radius: 8px;
margin-top: 15px;
transition: background-color 0.3s ease;
}
.expert-card:hover .expert-takeaway {
background-color: #f0f0f0;
}
.expert-content {
max-height: 0;
overflow: hidden;
transition: max-height 0.5s ease, padding 0.5s ease;
background-color: #fff;
border-top: 1px solid #eee;
}
.expert-content.show {
max-height: 2000px; /* Adjust based on content length */
padding: 15px;
}
.toggle-content {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.3s ease;
}
.toggle-content:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
{% extends "layout.html" %}
......@@ -180,7 +181,6 @@
</div>
</div>
</div>
<button class="toggle-btn" onclick="toggleContent(this)">Show Details</button>
</div>
</div>
</div>
......@@ -766,19 +766,48 @@
</div>
</div>
<script>
function toggleContent(button) {
const card = button.closest('.expert-card');
const content = card.querySelector('.expert-content');
if (content.style.display === 'none' || content.style.display === '') {
content.style.display = 'block';
button.textContent = 'Hide Details';
} else {
content.style.display = 'none';
button.textContent = 'Show Details';
}
function toggleContent(element) {
const card = element.closest('.expert-card');
const content = card.querySelector('.expert-content');
const button = card.querySelector('.toggle-content');
content.classList.toggle('show');
if (content.classList.contains('show')) {
button.textContent = 'Hide Details';
content.style.maxHeight = content.scrollHeight + "px";
} else {
button.textContent = 'Show Details';
content.style.maxHeight = "0";
}
// Prevent the click event from bubbling up to the card
event.stopPropagation();
}
</script>
// Add click event listener to the card
document.querySelector('.expert-card').addEventListener('click', function(event) {
if (event.target.classList.contains('toggle-content')) {
return; // Let the button handle its own click
}
const button = this.querySelector('.toggle-content');
toggleContent(button);
});
// Add the toggle button if it doesn't exist
window.addEventListener('load', function() {
const card = document.querySelector('.expert-card');
if (!card.querySelector('.toggle-content')) {
const button = document.createElement('button');
button.className = 'toggle-content';
button.textContent = 'Show Details';
button.onclick = function() { toggleContent(this); };
card.appendChild(button);
}
});
</script>
</body>
</html>
{% endblock %}
\ No newline at end of file
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