Line 294: | Line 294: | ||
height:200px !important; | height:200px !important; | ||
− | /* Create the parallax scrolling effect */ | + | <!-- /* Create the parallax scrolling effect */ --> |
background-attachment: fixed; | background-attachment: fixed; | ||
background-position: top center; | background-position: top center; | ||
Line 300: | Line 300: | ||
background-size: cover; | background-size: cover; | ||
} | } | ||
+ | |||
+ | <!-- Page specific - accordion --> | ||
+ | .accordion { | ||
+ | background-color: #eee; | ||
+ | color: #444; | ||
+ | cursor: pointer; | ||
+ | padding: 18px; | ||
+ | width: 100%; | ||
+ | border: none; | ||
+ | text-align: left; | ||
+ | outline: none; | ||
+ | font-size: 15px; | ||
+ | transition: 0.4s; | ||
+ | } | ||
+ | |||
+ | .active, .accordion:hover { | ||
+ | background-color: #ccc; | ||
+ | } | ||
+ | |||
+ | .accordion:after { | ||
+ | content: '\002B'; | ||
+ | color: #777; | ||
+ | font-weight: bold; | ||
+ | float: right; | ||
+ | margin-left: 5px; | ||
+ | } | ||
+ | |||
+ | .active:after { | ||
+ | content: "\2212"; | ||
+ | } | ||
+ | |||
+ | .panel { | ||
+ | padding: 0 18px; | ||
+ | background-color: white; | ||
+ | max-height: 0; | ||
+ | overflow: hidden; | ||
+ | transition: max-height 0.2s ease-out; | ||
+ | } | ||
+ | <!-- end accordion --> | ||
+ | |||
</style> | </style> | ||
</head> | </head> | ||
Line 378: | Line 418: | ||
<div class="row"> | <div class="row"> | ||
<div class="col-sm-8 col-sm-offset-2"> | <div class="col-sm-8 col-sm-offset-2"> | ||
− | + | <p>In this example we have added a "plus" sign to each button. When the user clicks on the button, the "plus" sign is replaced with a "minus" sign.</p> | |
− | + | <button class="accordion">Section 1</button> | |
− | </ | + | <div class="panel"> |
+ | <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="accordion">Section 2</button> | ||
+ | <div class="panel"> | ||
+ | <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> | </div> | ||
− | + | ||
− | + | <button class="accordion">Section 3</button> | |
+ | <div class="panel"> | ||
+ | <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 | ||
</div> | </div> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</div> | </div> | ||
</div> | </div> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | + | <!-- accordion script --> |
− | + | <script> | |
− | + | var acc = document.getElementsByClassName("accordion"); | |
− | + | var i; | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | for (i = 0; i < acc.length; i++) { | |
− | + | acc[i].addEventListener("click", function() { | |
− | + | this.classList.toggle("active"); | |
− | + | var panel = this.nextElementSibling; | |
− | + | if (panel.style.maxHeight){ | |
− | + | panel.style.maxHeight = null; | |
− | + | } else { | |
− | + | panel.style.maxHeight = panel.scrollHeight + "px"; | |
− | + | } | |
− | + | }); | |
− | + | } | |
− | + | </script> | |
− | + | <!-- accordion script end --> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
<style> | <style> |
Revision as of 11:20, 6 September 2018
Notebook
In this example we have added a "plus" sign to each button. When the user clicks on the button, the "plus" sign is replaced with a "minus" sign.
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.
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.
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.