|
|
(232 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | <!DOCTYPE html> | + | A playground, sandbox, test zone for Marc B and Thian. :-) |
| + | <!-- Google tag (gtag.js) --> |
| + | <script async src="https://www.googletagmanager.com/gtag/js?id=G-9FPK3M5Y7K"></script> |
| + | <script> |
| + | window.dataLayer = window.dataLayer || []; |
| + | function gtag(){dataLayer.push(arguments);} |
| + | gtag('js', new Date()); |
| + | |
| + | gtag('config', 'G-9FPK3M5Y7K'); |
| + | </script> |
| <html> | | <html> |
| + | <body> |
| <head> | | <head> |
− | <meta name="viewport" content="width=device-width, initial-scale=1">
| |
− | <style>
| |
− | .collapsible {
| |
− | background-color: #777;
| |
− | color: white;
| |
− | cursor: pointer;
| |
− | padding: 18px;
| |
− | width: 100%;
| |
− | border: none;
| |
− | text-align: left;
| |
− | outline: none;
| |
− | font-size: 15px;
| |
− | }
| |
| | | |
− | .active, .collapsible:hover {
| |
− | background-color: #555;
| |
− | }
| |
− |
| |
− | .content {
| |
− | padding: 0 18px;
| |
− | max-height: 0;
| |
− | overflow: hidden;
| |
− | transition: max-height 0.2s ease-out;
| |
− | background-color: #f1f1f1;
| |
− | }
| |
− | </style>
| |
| </head> | | </head> |
− | <body> | + | <h1>My First Heading</h1> |
− | | + | <p>My first paragraph.</p> |
− | <h2>Animated Collapsibles</h2>
| |
− | | |
− | <p>A Collapsible:</p>
| |
− | <button class="collapsible">Open Collapsible</button>
| |
− | <div class="content">
| |
− | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
| |
− | </div> | |
− | | |
− | <p>Collapsible Set:</p>
| |
− | <button class="collapsible">Open Section 1</button>
| |
− | <div class="content">
| |
− | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
| |
− | </div>
| |
− | <button class="collapsible">Open Section 2</button>
| |
− | <div class="content">
| |
− | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
| |
− | </div>
| |
− | <button class="collapsible">Open Section 3</button>
| |
− | <div class="content">
| |
− | <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
| |
− | </div>
| |
− | | |
− | <script>
| |
− | var coll = document.getElementsByClassName("collapsible");
| |
− | var i;
| |
− | | |
− | for (i = 0; i < coll.length; i++) {
| |
− | coll[i].addEventListener("click", function() {
| |
− | this.classList.toggle("active");
| |
− | var content = this.nextElementSibling;
| |
− | if (content.style.maxHeight){
| |
− | content.style.maxHeight = null;
| |
− | } else {
| |
− | content.style.maxHeight = content.scrollHeight + "px";
| |
− | }
| |
− | });
| |
− | }
| |
− | </script>
| |
| | | |
| </body> | | </body> |
| </html> | | </html> |
A playground, sandbox, test zone for Marc B and Thian. :-)
<script async src="https://www.googletagmanager.com/gtag/js?id=G-9FPK3M5Y7K"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-9FPK3M5Y7K');
</script>
<html>
<body>
<head>
</head>
My First Heading
My first paragraph.
</body>
</html>