- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Environmental Science
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- articles and Answers
- Effective Resume Writing
- HR Interview articles
- Computer Glossary
- Who is Who
How to create accordion on blogger using HTML & JavaScript ?
Create accordion using html & javascript on blogger. Its too much easy to create accordion using html & javascript . Below is the code by using you create an accordion on blogger using html & javascript.
HTML
<button class="acc">Show Answer</button>
<div class="pnl">
<p></p>
</div>
CSS
.acc {
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, .acc:hover {
background-color: #ccc;
}
.pnl {
padding: 0 18px;
display: none;
background-color: white;
overflow: hidden;
}
JavaScript
<script type='text/javascript'>
//<![CDATA[
var acc = document.getElementsByClassName("acc");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var pnl = this.nextElementSibling;
if (pnl.style.display === "block") {
pnl.style.display = "none";
} else {
pnl.style.display = "block"; }
});
}
//]]>
</script>
If you have any question regarding to create accordion using html & JavaScript you can ask questions on our support forum.
- Related Questions & Answers
- create an Attractive Poll UI Design using HTML CSS & JavaScript
- Create Page Reload Button Using JavaScript
- How to Create Text To Speech Converter in HTML & JavaScript
- Build a Dictionary App in HTML CSS & JavaScript
- Popup Share Modal UI Design using HTML CSS & JavaScript
- Santa Animation With HTML & CSS
- How to Highlight Searched Text Using JavaScript
- How to Build Weather App using HTML CSS & JavaScript
- Responsive Registration Form in HTML and CSS
- How To Create AdBlock Detector using HTML & JavaScript
- Minion Using Html & CSS | Despicable Me
- How To Create Superman Mode Minion Using HTML, CSS & JavaScript
- How to Add Scroll Animations to a Page with JavaScript’s Intersection Observer API
- Preview Image Before Upload Using JavaScript
- Create Minion Eyes Toggle using Pure CSS
- How to print page using JavaScript ?
Advertisements
ads