| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f166e3a commit e922591
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,3 +58,19 @@ searchBar.addEventListener('keyup', (e) => { | |||
| 58 | 58 | } | |
| 59 | 59 | }); | |
| 60 | 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 | + } | ||
| 76 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,20 @@ <h2 class="title">Books to Read</h2> | |||
| 43 | 43 | <input type="text" placeholder="Add a book..." /> | |
| 44 | 44 | <button>Add</button> | |
| 45 | 45 | </form> | |
| 46 | + <div id="tabbed-content"> | ||
| 47 | + <ul class="tabs"> | ||
| 48 | + <li data-target="#about" class="active">About</li> | ||
| 49 | + <li data-target="#contact">Contact</li> | ||
| 50 | + </ul> | ||
| 51 | + <div class="panel active" id="about"> | ||
| 52 | + <p>Content for about tab...</p> | ||
| 53 | + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id nunc porta urna ornare rhoncus. Ut convallis ante at.</p> | ||
| 54 | + </div> | ||
| 55 | + <div class="panel" id="contact"> | ||
| 56 | + <p>Content for contact tab...</p> | ||
| 57 | + <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id nunc porta urna ornare rhoncus. Ut convallis ante at.</p> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 46 | 60 | </div> | |
| 47 | 61 | <script src="app.js"></script> | |
| 48 | 62 | </body> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -124,7 +124,6 @@ h1, h2{ | |||
| 124 | 124 | line-height: 52px; | |
| 125 | 125 | } | |
| 126 | 126 | ||
| 127 | - /* | ||
| 128 | 127 | #tabbed-content li{ | |
| 129 | 128 | display: inline-block; | |
| 130 | 129 | padding: 10px 14px; | |
@@ -134,14 +133,13 @@ h1, h2{ | |||
| 134 | 133 | margin-right: 10px; | |
| 135 | 134 | } | |
| 136 | 135 | ||
| 137 | - #tabbed-content .tab{ | ||
| 136 | + #tabbed-content .panel{ | ||
| 138 | 137 | display: none; | |
| 139 | 138 | border: 1px solid #ddd; | |
| 140 | 139 | padding: 0 10px; | |
| 141 | 140 | border-radius: 4px; | |
| 142 | 141 | } | |
| 143 | 142 | ||
| 144 | - #tabbed-content .tab.active{ | ||
| 143 | + #tabbed-content .panel.active{ | ||
| 145 | 144 | display: block; | |
| 146 | 145 | } | |
| 147 | - */ | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments