Spaces:
Sleeping
Sleeping
Update static/test.js
Browse files- static/test.js +29 -8
static/test.js
CHANGED
|
@@ -215,21 +215,35 @@ function showSection(sectionId) {
|
|
| 215 |
// Function to show the selected section and hide the others
|
| 216 |
// Main navigation and shared utility functions
|
| 217 |
function showSection(sectionId) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
// Hide all tool sections
|
| 219 |
const sections = document.querySelectorAll('.tool-section');
|
| 220 |
sections.forEach(section => {
|
| 221 |
section.style.display = 'none';
|
| 222 |
});
|
| 223 |
-
|
| 224 |
-
//
|
| 225 |
-
|
| 226 |
-
if (activeSection) {
|
| 227 |
-
activeSection.style.display = 'block';
|
| 228 |
-
activeSection.scrollIntoView({ behavior: 'smooth' });
|
| 229 |
-
}
|
| 230 |
}
|
| 231 |
|
| 232 |
-
|
|
|
|
| 233 |
document.addEventListener('DOMContentLoaded', () => {
|
| 234 |
// Set up card click handlers
|
| 235 |
document.querySelectorAll('.card').forEach(card => {
|
|
@@ -239,6 +253,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 239 |
});
|
| 240 |
});
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
// Show first section by default
|
| 243 |
showSection('document-image-analysis');
|
| 244 |
|
|
|
|
| 215 |
// Function to show the selected section and hide the others
|
| 216 |
// Main navigation and shared utility functions
|
| 217 |
function showSection(sectionId) {
|
| 218 |
+
// Show the selected section (in case it was hidden)
|
| 219 |
+
const activeSection = document.getElementById(sectionId);
|
| 220 |
+
if (activeSection) {
|
| 221 |
+
activeSection.style.display = 'block';
|
| 222 |
+
// Scroll to the section smoothly
|
| 223 |
+
activeSection.scrollIntoView({
|
| 224 |
+
behavior: 'smooth',
|
| 225 |
+
block: 'start' // Aligns the section at the top of the viewport
|
| 226 |
+
});
|
| 227 |
+
}
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
function showCards() {
|
| 232 |
+
// Show cards section
|
| 233 |
+
document.querySelector('.cards').style.display = 'grid'; // or 'flex' depending on your layout
|
| 234 |
+
|
| 235 |
// Hide all tool sections
|
| 236 |
const sections = document.querySelectorAll('.tool-section');
|
| 237 |
sections.forEach(section => {
|
| 238 |
section.style.display = 'none';
|
| 239 |
});
|
| 240 |
+
|
| 241 |
+
// Scroll to top
|
| 242 |
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
}
|
| 244 |
|
| 245 |
+
|
| 246 |
+
|
| 247 |
document.addEventListener('DOMContentLoaded', () => {
|
| 248 |
// Set up card click handlers
|
| 249 |
document.querySelectorAll('.card').forEach(card => {
|
|
|
|
| 253 |
});
|
| 254 |
});
|
| 255 |
|
| 256 |
+
// Hide all tool sections by default
|
| 257 |
+
const sections = document.querySelectorAll('.tool-section');
|
| 258 |
+
sections.forEach(section => {
|
| 259 |
+
section.style.display = 'none';
|
| 260 |
+
});
|
| 261 |
+
});
|
| 262 |
+
|
| 263 |
// Show first section by default
|
| 264 |
showSection('document-image-analysis');
|
| 265 |
|