jemand anders
Erfahrenes Mitglied
Hallo,
jemand eine Idee, warum Transition im Beispiel nicht funktioniert?
Freundl. Grüße
jemand eine Idee, warum Transition im Beispiel nicht funktioniert?
Freundl. Grüße
HTML:
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Transition</title>
<style>
.d1 {
background: #f7f7f7;
border: 1px solid #bbb;
padding: 0px 10px;
}
p {
background: #ccc;
padding-left: 5px;
width: 100%;
}
p:hover {
cursor: pointer;
}
ul {
background: #fff;
border: 1px solid #ddd;
max-height: initial;
overflow: visible;
padding-top: 10px;
padding-bottom: 10px;
transition: max-height 1.5s ease-in-out;
}
ul.hidden {
border: transparent;
max-height: 0;
overflow: hidden;
padding: 0;
}
</style>
</head>
<body>
<div class="d1">
<p class="p1" title="Klicken für Öffnen/Schließen">18.3.2025</p>
<ul class="">
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
<li>
<a href="https://www.tutorials.de/" rel="nofollow" target="_blank"
>tutorials.de</a
>
</li>
</ul>
</div>
<script>
const paragraphs = document.querySelectorAll("p");
paragraphs.forEach((p) => {
p.addEventListener("click", function () {
p.nextElementSibling.classList.toggle("hidden");
});
});
</script>
</body>
</html>