| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,4 +57,20 @@ searchBar.addEventListener('keyup', (e) => { | |||
| 57 | 57 | book.style.display = 'none'; | |
| 58 | 58 | } | |
| 59 | 59 | }); | |
| 60 | + }); | ||
| 61 | + | ||
| 62 | + // tabbed content | ||
| 63 | + const tabs = document.querySelector('.tabs'); | ||
| 64 | + const panels = document.querySelectorAll('.panel'); | ||
| 65 | + tabs.addEventListener('click', (e) => { | ||
| 66 | + if(e.target.tagName == 'LI'){ | ||
| 67 | + const targetPanel = document.querySelector(e.target.dataset.target); | ||
| 68 | + Array.from(panels).forEach((panel) => { | ||
| 69 | + if(panel == targetPanel){ | ||
| 70 | + panel.classList.add('active'); | ||
| 71 | + }else{ | ||
| 72 | + panel.classList.remove('active'); | ||
| 73 | + } | ||
| 74 | + }); | ||
| 75 | + } | ||
| 60 | 76 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,6 +44,20 @@ <h2 class="title">Books to Read</h2> | |||
| 44 | 44 | <input type="text" placeholder="Add a book..." /> | |
| 45 | 45 | <button>Add</button> | |
| 46 | 46 | </form> | |
| 47 | + <div id="tabbed-content"> | ||
| 48 | + <ul class="tabs"> | ||
| 49 | + <li data-target="#about" class="active">About</li> | ||
| 50 | + <li data-target="#contact">Contact</li> | ||
| 51 | + </ul> | ||
| 52 | + <div class="panel active" id="about"> | ||
| 53 | + <p>Content for about tab...</p> | ||
| 54 | + <p>Text</p> | ||
| 55 | + </div> | ||
| 56 | + <div class="panel" id="contact"> | ||
| 57 | + <p>Content for contact tab...</p> | ||
| 58 | + <p>Text</p> | ||
| 59 | + </div> | ||
| 60 | + </div> | ||
| 47 | 61 | ||
| 48 | 62 | </div> | |
| 49 | 63 | <script src="app.js"></script> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments