Widget:ToggleWidth: Difference between revisions

From The Midnight Wiki
(Created page with "<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> #myDIV { width: 100%; padding: 50px 0; text-align: center; background-color: lightblue; margin-top: 20px; } </style> </head> <body> <p>Click the "Try it" button to toggle between hiding and showing the DIV element:</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> This is my DIV element. </div> <p><b>Note:</b> The element will not take up any space w...")
 
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
{{#widget:ToggleWidth}}
</noinclude>
<includeonly>
<html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#myDIV {
  width: 100%;
  padding: 50px 0;
  text-align: center;
  background-color: lightblue;
  margin-top: 20px;
}
</style>
</head>
<body>
<p>Click the "Try it" button to toggle between hiding and showing the DIV element:</p>
<button onclick="myFunction()">Try it</button>
<button onclick="myFunction()">Try it</button>
<div id="myDIV">
This is my DIV element.
</div>
<p><b>Note:</b> The element will not take up any space when the display property set to "none".</p>
<script>
<script>
function myFunction() {
function myFunction() {
   var x = document.getElementById("myDIV");
   var x = document.getElementsByClassName("ts-inner");
   if (x.style.display === "none") {
  for (i in x) {
     x.style.display = "block";
   if (x[i].style.maxWidth === "none") {
     x[i].style.maxWidth = "115em";
   } else {
   } else {
     x.style.display = "none";
     x[i].style.maxWidth = "none";
   }
   }
}
}
}
</script>
</script>
</body>
</html>
</html>
</includeonly>

Latest revision as of 14:31, 5 July 2023