Add tabs to lcp-ui js and css
This commit is contained in:
@ -31,4 +31,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const tabs = document.querySelectorAll('.tab-link');
|
||||||
|
const panes = document.querySelectorAll('.tab-pane');
|
||||||
|
|
||||||
|
tabs.forEach(tab => {
|
||||||
|
tab.addEventListener('click', function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Remove active class from all tabs and panes
|
||||||
|
tabs.forEach(link => link.classList.remove('active'));
|
||||||
|
panes.forEach(pane => pane.classList.remove('active'));
|
||||||
|
|
||||||
|
// Add active class to the clicked tab and its corresponding pane
|
||||||
|
tab.classList.add('active');
|
||||||
|
const targetPane = document.querySelector(tab.getAttribute('href'));
|
||||||
|
targetPane.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
39
style.css
39
style.css
@ -238,3 +238,42 @@ Version: 1.0
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* LCP TABS */
|
||||||
|
/* Simple styles for tabs */
|
||||||
|
#myTab {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#myTab li {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-link {
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: lightgray;
|
||||||
|
color: black;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-link.active {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Style for the content panes */
|
||||||
|
.tab-pane {
|
||||||
|
display: none;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-pane.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user