Beispiel:Iframe-child-1.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche

<!DOCTYPE html> <html lang="de"> <head>

 <meta charset="UTF-8" >
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
 <title>Einzubettende Seite</title>
 <style>
   body {
     margin: 0;
     padding: 1rem;
     font-family: sans-serif;
     transition: all 0.5s ease;

background: steelblue; } h1 { color: white;

   }
   #content {
     background: lightblue; transition: height 0.3s; overflow: hidden; padding: 1em;
   }
 </style>

</head> <body>

Einzubettende Seite

<output id="output"></output>

 <script>

function rand (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; }

function changeHeight() {

 const content = document.getElementById("content");
 const output = document.getElementById("output");
 const newHeight = rand(1,20); 
 content.style.height = newHeight + "em";
 output.textContent = "Höhe: " + newHeight + "em";

}

   setInterval(changeHeight, 3000);
   changeHeight();
 </script>

</body> </html>