Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions css/cards.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ span.card-basic {
background-color: rgba(255, 255, 255, 0.0512);
}

.expander-top.active {
.expander-top[aria-expanded="true"] {
background-color: rgba(255, 255, 255, 0.0612);
}

Expand All @@ -119,16 +119,23 @@ span.card-basic {

.expander-bottom {
background-color: rgba(255, 255, 255, 0.0512);
display: none;
animation: slide-up 0.4s;
z-index: 0;
position: relative;
overflow-y: hidden;
margin-top: 0 !important;
max-height: 0;
opacity: 0;
overflow-y: hidden;
transition: max-height 300ms ease, opacity 300ms ease;
}

.expander-top[aria-expanded="true"] ~ .expander-bottom {
opacity: 1;
}

.expander-top[aria-expanded="true"] .chevron {
transform: rotate(180deg)!important;
}

.expander-opened {
animation: slide-down 2s;
.chevron {
transition: transform 300ms ease;
}

/* Chevron icon */
Expand Down
36 changes: 15 additions & 21 deletions js/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function fadeOut(element) {
element.style.opacity = "0%";
}

function rotate(element, rotation = 180) {
element.style.transform = 'rotatex(' + rotation + 'deg)';
}
// function rotate(element, rotation = 180) {
// element.style.transform = 'rotatex(' + rotation + 'deg)';
// }

function setupExpanders() {
const expanders = document.querySelectorAll('.expander-top');
Expand Down Expand Up @@ -77,26 +77,20 @@ function setupExpanders() {
});
}

function expandCard(thisObj, $open, $dontReset) {
const chevron = thisObj.getElementsByClassName("chevron")[0]
if ($open.classList.contains('expander-opened') && !$dontReset) {
rotate(chevron, 0)
$open.classList.remove('expander-opened');
setTimeout(() => $open.style.display = "none", 400);
thisObj.classList.remove('active');
function expandCard(thisObj, $open) {
if (thisObj.getAttribute('aria-expanded')) {
thisObj.removeAttribute('aria-expanded');
$open.style.maxHeight = 0;
}
else {
$open.classList.add('expander-opened');
rotate(chevron, 180);
$open.style.display = "block";
thisObj.classList.add('active');

const textareas = $open.querySelectorAll('.auto-resize');
if (textareas) {
for (var i = 0; i < textareas.length; i++) {
autoResize(textareas[i]);
}
}
thisObj.setAttribute('aria-expanded', 'true');
$open.style.maxHeight = $open.scrollHeight + 'px';
// const textareas = $open.querySelectorAll('.auto-resize');
// if (textareas) {
// for (var i = 0; i < textareas.length; i++) {
// autoResize(textareas[i]);
// }
// }
}
}

Expand Down