Skip to content

Commit

Permalink
Mobile Version
Browse files Browse the repository at this point in the history
  • Loading branch information
AKMaily committed Jun 18, 2024
1 parent 3d18105 commit 395abab
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 49 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</head>

<body>
<button class="menu-button">Menu</button>
<div class="navbar" id="navbar">
<ul class="navbar-links">
<li>
Expand Down
68 changes: 37 additions & 31 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
const checklistItems = document.querySelectorAll('.checklist li');

// Initialisiere die Checkliste basierend auf dem gespeicherten Zustand
Expand All @@ -15,8 +15,8 @@ document.addEventListener('DOMContentLoaded', function() {
// Füge Klick-Event für Checkliste hinzu
checklistItems.forEach(item => {
const checkbox = item.querySelector('input[type="checkbox"]');
checkbox.addEventListener('change', function() {

checkbox.addEventListener('change', function () {
if (this.checked) {
item.classList.add('completed');
localStorage.setItem(checkbox.id, 'true');
Expand All @@ -28,23 +28,29 @@ document.addEventListener('DOMContentLoaded', function() {
});
});

// script.js
document.addEventListener("DOMContentLoaded", function () {
var menuButton = document.querySelector(".menu-button");
var navbar = document.querySelector(".navbar");

menuButton.addEventListener("click", function () {
navbar.classList.toggle("active");

});
});




// script.js

// Funktion zur Steuerung des Burgermenüs
document.addEventListener("DOMContentLoaded", function() {
const burgerIcon = document.getElementById("burger-icon");
document.addEventListener("DOMContentLoaded", function () {
const navbar = document.getElementById("navbar");
const navbarLinks = document.getElementById("navbar-links");

burgerIcon.addEventListener("click", function() {
navbar.classList.toggle("active");
});

// Schließe das Burgermenü, wenn auf einen Link geklickt wird
navbarLinks.querySelectorAll("a").forEach(link => {
link.addEventListener("click", function() {
link.addEventListener("click", function () {
navbar.classList.remove("active");
});
});
Expand All @@ -53,24 +59,24 @@ document.addEventListener("DOMContentLoaded", function() {


function copyToClipboard(index) {
const codeboxes = document.querySelectorAll('.codebox pre');
const code = codeboxes[index].textContent.trim();

navigator.clipboard.writeText(code)
.then(() => {
showCopyMessage(index);
})
.catch(err => {
console.error('Fehler beim Kopieren: ', err);
});
}

function showCopyMessage(index) {
const copyMessages = document.querySelectorAll('.copy-message');
copyMessages[index].style.display = 'inline-block';

setTimeout(() => {
copyMessages[index].style.display = 'none';
}, 2000);
}
const codeboxes = document.querySelectorAll('.codebox pre');
const code = codeboxes[index].textContent.trim();

navigator.clipboard.writeText(code)
.then(() => {
showCopyMessage(index);
})
.catch(err => {
console.error('Fehler beim Kopieren: ', err);
});
}

function showCopyMessage(index) {
const copyMessages = document.querySelectorAll('.copy-message');
copyMessages[index].style.display = 'inline-block';

setTimeout(() => {
copyMessages[index].style.display = 'none';
}, 2000);
}

90 changes: 72 additions & 18 deletions styles.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/* Basis-Stile */
body {
font-family: Arial, sans-serif;
line-height: 1.6;
margin: 0 auto;
max-width: 800px;
padding: 20px;
background-color: #000000;
/* Dunkle Sonnenuntergangsfarbe für den Hintergrund */
color: #FFFFFF;
/* Weiße Textfarbe */
}

.content {
margin: 20px;
}

.infobox {
Expand All @@ -22,15 +25,14 @@ body {

.nebeninfo {
background-color: rgb(0, 68, 2);
/* Rote Sonnenuntergangsfarbe für Infoboxen */
/* Grüne Farbe für Nebeninfo */
padding: 10px;
margin-bottom: 15px;
border: 1px solid green;
/* Etwas dunklere Rote Farbe für den Rahmen */
/* Etwas dunklere Grüne Farbe für den Rahmen */
border-radius: 10px;
}


/* Stil für Codeboxen */
.codebox {
position: relative;
Expand Down Expand Up @@ -201,26 +203,31 @@ body {
text-decoration: underline;
}

/* styles.css */
/* styles.css */

/* Navigation Bar */
/* Navigation Bar */
.navbar {
background-color: #f0f0f0;
background-color: #333;
position: fixed;
left: 0;
top: 0;
height: 100%;
left: 0;
width: 250px;
/* Breite der Navigationsleiste */
height: 100%;
overflow-x: hidden;
transition: 0.5s;
transition: transform 0.3s ease;
z-index: 1000;
transform: translateX(-100%);
}

.navbar.active {
transform: translateX(0);
}

.navbar-links {
list-style-type: none;
padding: 20px 0;
padding: 0;
margin: 0;
margin-top: 60px;
/* Platz für den Menü-Button */
}

.navbar-links li {
Expand All @@ -230,12 +237,13 @@ body {
.navbar-links a {
display: block;
text-decoration: none;
color: #333;
color: white;
/* Weiße Textfarbe für Links */
transition: background-color 0.3s;
}

.navbar-links a:hover {
background-color: #ddd;
background-color: #575757;
}

.sub-links {
Expand All @@ -253,9 +261,55 @@ body {
}

.sub-links a {
color: #666;
color: #CCCCCC;
}

.sub-links a:hover {
color: #444;
color: #AAAAAA;
}

.menu-button {
position: fixed;
top: 15px;
left: 15px;
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
font-size: 16px;
cursor: pointer;
border-radius: 3px;
z-index: 1100;
}

.menu-button:hover {
background-color: #45a049;
}

.menu-button.hidden {
display: none;
}


/* Media Queries */
@media (max-width: 768px) {
.navbar {
width: 100%;
height: auto;
position: relative;
}

.navbar-links {
display: flex;
flex-direction: column;
}

.navbar-links li {
text-align: center;
}

body {
padding-top: 60px;
/* Platz für die Menüschaltfläche */
}
}

0 comments on commit 395abab

Please sign in to comment.