Skip to content

Commit

Permalink
TOGGLE CARD
Browse files Browse the repository at this point in the history
  • Loading branch information
CherrelleTucker committed Dec 30, 2024
1 parent 3736f7b commit 61882e4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
18 changes: 18 additions & 0 deletions _tabs/Assessment.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,26 @@ order: 3
</div>

<script>
/**
* Toggles the expanded/collapsed state of a card
* @param {HTMLElement} header - The header element that was clicked
*/
function toggleCard(header) {
// Toggle active class on header
header.classList.toggle('active');

// Toggle active class on content section
const content = header.nextElementSibling;
content.classList.toggle('active');

// Close other open cards
const allHeaders = document.querySelectorAll('.card-header');
allHeaders.forEach(otherHeader => {
if (otherHeader !== header && otherHeader.classList.contains('active')) {
otherHeader.classList.remove('active');
otherHeader.nextElementSibling.classList.remove('active');
}
});
}

function showTab(tabName) {
Expand Down
24 changes: 24 additions & 0 deletions _tabs/SEP.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,30 @@ function showTab(tabName) {
</script>

<style>
<!-- JavaScript for card toggling -->
<script>
/**
* Toggles the expanded/collapsed state of a card
* @param {HTMLElement} header - The header element that was clicked
*/
function toggleCard(header) {
// Toggle active class on header
header.classList.toggle('active');

// Toggle active class on content section
const content = header.nextElementSibling;
content.classList.toggle('active');

// Close other open cards
const allHeaders = document.querySelectorAll('.card-header');
allHeaders.forEach(otherHeader => {
if (otherHeader !== header && otherHeader.classList.contains('active')) {
otherHeader.classList.remove('active');
otherHeader.nextElementSibling.classList.remove('active');
}
});
}

/* Base styles from Overview page */
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
Expand Down

0 comments on commit 61882e4

Please sign in to comment.