An open API service indexing awesome lists of open source software.

https://github.com/codeadamca/javascript-accordion

A basic JavaScript and HTML accordion.
https://github.com/codeadamca/javascript-accordion

javascript learning-code

Last synced: 7 months ago
JSON representation

A basic JavaScript and HTML accordion.

Awesome Lists containing this project

README

          

# JavaScript Accordion

A basic JavaScript and HTML accordion.

## Coding from Scratch

When coding something like a JavaScript accordion, half of the problem is how to split the lager objective into small steps. Download a copy of the `index.html` and `accordionjs` files and then follow these steps. Do not proceed to the next step until the current one is done and tested.

1. Use CSS to hide all sections of content.
2. Add a click event to the section titles. For now `console.log()` the word "open".
3. Function needs to know which section was clicked. Use `console.log()` to confirm.
4. On `click`, make the content below the link visible.
5. Use an `if` statement to hide or display the content.
6. Hide all other accordion content before displaying the new content.

***

## Repo Resources

* [Visual Studio Code](https://code.visualstudio.com/)
* [W3Schools - JavaScript](https://www.w3schools.com/js/)