Malý repozitář do hodin WTL pro 3.J skupinu WEB
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

140 lines
5.2 KiB

<!DOCTYPE html>
<html lang="en" data-bs-theme="auto">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<meta name="theme-color" content="#712cf9">
<style>
/* .bd-mode-toggle {
z-index: 1500;
}
.bd-mode-toggle .dropdown-menu .active .bi {
display: block !important;
} */
</style>
</head>
<body>
<div class="dropdown position-fixed bottom-0 end-0 mb-3 me-3 bd-mode-toggle">
<button class="btn btn-bd-primary py-2 dropdown-toggle d-flex align-items-center"
id=" "
type="button"
aria-expanded="false"
data-bs-toggle="dropdown"
aria-label="Změna vzhledu"
>
Dark/Light</button>
<ul class="dropdown-menu dropdown-menu-end shadow"
aria-labelledby="bd-theme-text">
<li>
<button type="button"
class="dropdown-item d-flex align-items-center"
data-bs-theme-value="light"
aria-pressed="false"> Light</button>
</li>
<li>
<button type="button"
class="dropdown-item d-flex align-items-center"
data-bs-theme-value="dark"
aria-pressed="false"> dark</button>
</li>
<li>
<button type="button"
class="dropdown-item d-flex align-items-center"
data-bs-theme-value="auto"
aria-pressed="false"> auto</button>
</li>
</ul>
</div>
<header data-bs-theme="dark">
<div class="collapse text-bg-dark" id="navbarHeader">
<div class="container">
<div class="row">
<div class="col-sm-8 col-md-7 py-4">
<h4 class="text-white">TEMPLATE</h4>
<p class="">LOOOREM</p>
</div>
<div class="col-sm-4 offset-md-1 py-4">
<h4>Odkazy</h4>
<!-- ul.list-unstyled>li*4>a.text-white -->
<ul class="list-unstyled">
<li><a href="" class="text-white">TEST1</a></li>
<li><a href="" class="text-white">TEST2</a></li>
<li><a href="" class="text-white">TEST3</a></li>
<li><a href="" class="text-white">TEST4</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="navbar navbar-dark bg-dark shadow-sm">
<div class="container">
<a class="navbar-brand d-flex" href="#">
<strong>TempTitle</strong>
</a>
<button class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarHeader"
aria-controls="navbarHeader"
aria-expanded="false"
aria-label="Toggle navbar"
> <span class="navbar-toggler-icon"></span></button>
</div>
</div>
</header>
<main>
</main>
<footer class="text-body-secondary py-5">
<div class="container">
<p class="float-end mb-1"><a href="#"> Zpět nahoru</a></p>
<p class="mb-1"> Jméno.Příjmení @ 2024</p>
</div>
</footer>
<script src="js/bootstrap.bundle.js"></script>
<script>
// Funkce pro přepnutí tématu
document.addEventListener('DOMContentLoaded', function () {
const themeToggle = document.getElementById('bd-theme');
const themeButtons = document.querySelectorAll('[data-bs-theme-value]');
const root = document.documentElement;
// Nastavení aktuálního tématu
function setTheme(theme) {
root.setAttribute('data-bs-theme', theme);
localStorage.setItem('theme', theme); // Uloží výběr do localStorage
updateActiveButton(theme);
}
// Aktualizace aktivního tlačítka
function updateActiveButton(theme) {
themeButtons.forEach(button => {
const isActive = button.getAttribute('data-bs-theme-value') === theme;
button.setAttribute('aria-pressed', isActive);
});
}
// Načtení uloženého tématu (pokud existuje)
const storedTheme = localStorage.getItem('theme') || 'auto';
setTheme(storedTheme);
// Přidání události pro kliknutí na tlačítka
themeButtons.forEach(button => {
button.addEventListener('click', function () {
const theme = this.getAttribute('data-bs-theme-value');
setTheme(theme);
});
});
});
</script>
</body>
</html>