(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> | ||
<button onclick="myFunction()">Try it</button> | <button onclick="myFunction()">Try it</button> | ||
<script> | <script> | ||
function myFunction() { | function myFunction() { | ||
var x = document. | var x = document.getElementsByClassName("ts-inner"); | ||
if (x.style. | for (i in x) { | ||
x.style. | if (x[i].style.maxWidth === "none") { | ||
x[i].style.maxWidth = "115em"; | |||
} else { | } else { | ||
x.style. | x[i].style.maxWidth = "none"; | ||
} | } | ||
} | |||
} | } | ||
</script> | </script> | ||
</html> | </html> | ||
</includeonly> |
Latest revision as of 14:31, 5 July 2023