Attention-Tracker / demo.html
johnsonhung906
website init
f9c925e
raw
history blame
4.13 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Gallery</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #f4f4f4;
padding: 20px;
}
.image-gallery {
display: flex; /* Use flexbox for side-by-side images */
justify-content: center;
gap: 20px; /* Space between images */
margin-top: 20px; /* Add space above the image gallery */
}
.image-gallery img {
width: 80%; /* Set width to 80% of the window */
max-width: 500px; /* Ensure maximum width remains 500px */
height: auto; /* Maintain aspect ratio */
border-radius: 10px; /* Rounded corners for images */
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1); /* Add shadow to images */
display: none; /* Initially hide all images */
}
.button-container {
text-align: center;
margin-top: 20px;
}
.button-container .group-title {
font-weight: bold;
margin: 20px 0 10px;
font-size: 1.2em;
}
.normal-button {
background-color: #28a745; /* Green for Normal Data */
}
.attack-button {
background-color: #dc3545; /* Red for Attack Data */
}
.button-container button {
padding: 10px 20px;
margin: 5px;
border: none;
color: white;
cursor: pointer;
border-radius: 5px;
font-size: 1em; /* Increased font size */
transition: background-color 0.3s, transform 0.3s; /* Smooth transitions */
}
.button-container button:hover {
transform: scale(1.05); /* Slightly increase size on hover */
}
.normal-button:hover {
background-color: #218838; /* Darker green on hover */
}
.attack-button:hover {
background-color: #c82333; /* Darker red on hover */
}
</style>
</head>
<body>
<script>
function showNormalImage(normalImageId) {
// Hide all normal images
var normalImages = document.querySelectorAll('.image-gallery img[id^="normalImage"]');
normalImages.forEach(function(image) {
image.style.display = 'none'; // Hide normal images
});
// Show the selected normal image
document.getElementById(normalImageId).style.display = 'block'; // Show the selected normal image
// Optionally, you can show the corresponding attack image by default
// Uncomment the following line if you want the first attack image to be displayed when a normal image is shown
// document.getElementById('attackImage1').style.display = 'block'; // Show the default attack image
}
function showAttackImage(attackImageId) {
// Hide all attack images
var attackImages = document.querySelectorAll('.image-gallery img[id^="attackImage"]');
attackImages.forEach(function(image) {
image.style.display = 'none'; // Hide attack images
});
// Show the selected attack image
document.getElementById(attackImageId).style.display = 'block'; // Show the selected attack image
// Optionally, you can show the corresponding normal image by default
// Uncomment the following line if you want the first normal image to be displayed when an attack image is shown
// document.getElementById('normalImage1').style.display = 'block'; // Show the default normal image
}
// Initial display settings
document.getElementById('normalImage1').style.display = 'block'; // Show first normal image
document.getElementById('attackImage1').style.display = 'block'; // Show first attack image
</script>
</body>
</html>