-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replicate some style and js functionality from FE setup
- Loading branch information
1 parent
6120989
commit a3bd235
Showing
2 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
$('.answer h3').each(function(idx, title) { | ||
const titleText = $(title).text(); | ||
$(title).replaceWith(`<h3><img class="expander-arrow" src="/assets/images/arrow.svg" alt="expander arrow" /> ${titleText}</h3>`); | ||
}); | ||
|
||
$('.answer h3').nextAll().hide(); | ||
|
||
$('.answer h3').on('click', function() { | ||
let arrowEl = $(this).find('img.expander-arrow'); | ||
|
||
if (!arrowEl.hasClass('expanded')) { | ||
arrowEl.addClass('expanded'); | ||
arrowEl.parent('h3').nextAll().show(150); | ||
} else { | ||
arrowEl.removeClass('expanded'); | ||
arrowEl.parent('h3').nextAll().hide(150); | ||
} | ||
}); |