|
1 | | -<!-- TODO: Webseite mit 5 Themen (HTML5, CSS, JavaScript, |
2 | | - FlexBox, GridBox), die mithilfe des z-Indexes |
3 | | - übereinander liegen --> |
4 | | - |
5 | 1 | <!DOCTYPE html> |
6 | 2 | <html lang="de"> |
7 | | - |
8 | 3 | <head> |
9 | 4 | <meta charset="UTF-8"> |
10 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
11 | | - <title>Labor 5 - Login</title> |
12 | | - <link rel="stylesheet" href="css/general.css"> |
| 6 | + <title>Dein Interessensbereich</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + font-family: Arial, sans-serif; |
| 10 | + text-align: center; |
| 11 | + background-color: #f4f4f4; |
| 12 | + margin: 0; |
| 13 | + padding: 20px; |
| 14 | + } |
| 15 | + .container { |
| 16 | + position: relative; |
| 17 | + width: 80%; |
| 18 | + max-width: 600px; |
| 19 | + margin: auto; |
| 20 | + background: white; |
| 21 | + padding: 20px; |
| 22 | + border-radius: 10px; |
| 23 | + box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2); |
| 24 | + } |
| 25 | + .topic { |
| 26 | + position: absolute; |
| 27 | + width: 100%; |
| 28 | + padding: 20px; |
| 29 | + border-radius: 10px; |
| 30 | + transition: opacity 0.5s ease-in-out; |
| 31 | + } |
| 32 | + #html5 { background-color: lightcoral; z-index: 1; } |
| 33 | + #css { background-color: lightblue; z-index: 1; } |
| 34 | + #javascript { background-color: lightgreen; z-index: 1; } |
| 35 | + </style> |
13 | 36 | </head> |
14 | | - |
15 | 37 | <body> |
16 | | - <div class="content-container" style="z-index: 0;"> |
17 | | - <h1>I am section 1</h1> |
| 38 | +<div class="container"> |
| 39 | + <h1>Dein Interessensbereich</h1> |
| 40 | + <div id="html5" class="topic"> |
| 41 | + <h2>HTML5</h2> |
| 42 | + <p>HTML5 ist die aktuelle Version der Hypertext Markup Language mit neuen Funktionen.</p> |
| 43 | + <ul> |
| 44 | + <li>Semantische Tags wie <article>, <section>, <nav></li> |
| 45 | + <li>Unterstützung für Audio und Video ohne Plugins</li> |
| 46 | + <li>Canvas für 2D-Grafiken und Animationen</li> |
| 47 | + </ul> |
18 | 48 | </div> |
19 | | - <div class="content-container" style="z-index: 1;"> |
20 | | - <h1> I am section 2</h1> |
| 49 | + <div id="css" class="topic"> |
| 50 | + <h2>CSS</h2> |
| 51 | + <p>CSS ermöglicht das Styling von Webseiten mit Layout-Techniken wie Flexbox und Grid.</p> |
| 52 | + <ul> |
| 53 | + <li>Flexbox für flexible Layouts</li> |
| 54 | + <li>CSS Grid für komplexe Designs</li> |
| 55 | + <li>Animationen und Transitionen</li> |
| 56 | + </ul> |
21 | 57 | </div> |
22 | | - <div class="content-container" style="z-index: 2;"> |
23 | | - <h1> I am section 3</h1> |
| 58 | + <div id="javascript" class="topic"> |
| 59 | + <h2>JavaScript</h2> |
| 60 | + <p>JavaScript ermöglicht interaktive Webseiten mit dynamischen Inhalten.</p> |
| 61 | + <ul> |
| 62 | + <li>DOM-Manipulation für dynamische Webseiten</li> |
| 63 | + <li>Event Handling und Benutzerinteraktion</li> |
| 64 | + <li>Integration von APIs und Datenbanken</li> |
| 65 | + </ul> |
24 | 66 | </div> |
25 | | -</body> |
| 67 | +</div> |
| 68 | +<script> |
| 69 | + document.addEventListener("DOMContentLoaded", async () => { |
| 70 | + try { |
| 71 | + const response = await fetch("/getUserData"); |
| 72 | + const data = await response.json(); |
26 | 73 |
|
| 74 | + if (!data.topic) { |
| 75 | + window.location.href = "registration.html"; |
| 76 | + return; |
| 77 | + } |
| 78 | + |
| 79 | + document.querySelectorAll(".topic").forEach(el => el.style.display = "none"); |
| 80 | + |
| 81 | + const topicMap = { |
| 82 | + "html": "html5", |
| 83 | + "css": "css", |
| 84 | + "js": "javascript" |
| 85 | + }; |
| 86 | + |
| 87 | + const activeTopic = document.getElementById(topicMap[data.topic]); |
| 88 | + if (activeTopic) { |
| 89 | + activeTopic.style.display = "block"; |
| 90 | + activeTopic.style.zIndex = "10"; |
| 91 | + } else { |
| 92 | + console.error("Kein passendes Thema gefunden für:", data.topic); |
| 93 | + } |
| 94 | + } catch (error) { |
| 95 | + console.error("Fehler beim Laden der Benutzerdaten:", error); |
| 96 | + } |
| 97 | + }); |
| 98 | +</script> |
| 99 | +</body> |
27 | 100 | </html> |
0 commit comments