EyeTrackVR-Docs/docs/_includes/custom/FAQ/faq_template.html
ZanzyTHEbar c1767715ad update
- fix css translate on drop down icon for accordion
2022-06-06 00:44:20 +02:00

97 lines
2.9 KiB
HTML

<style>
.accordion {
width: 100%;
margin: 1px auto;
padding: 5px 5px;
}
.accordion .container {
position: relative;
margin: 5px 5px;
}
/* Positions the labels relative to the .container. Adds padding to the top and bottom and increases font size. Also makes its cursor a pointer */
.accordion .question {
position: relative;
padding: 5px 0;
font-size: 30px;
cursor: pointer;
}
/* Positions the plus sign 5px from the right. Centers it using the transform property. */
.accordion .question::before {
content: '\2304';
position: absolute;
top: 50%;
right: 5px;
font-size: 30px;
transform: translateY(-50%);
}
/* Hides the content (height: 0), decreases font size, justifies text and adds transition */
.accordion .answer {
position: relative;
height: 0;
font-size: 20px;
text-align: justify;
width: 100%;
transition: 0.5s;
overflow: hidden;
}
/* Adds a horizontal line between the contents */
.accordion hr {
width: 100%;
margin-left: 0;
border: 1px solid grey;
}
/* Unhides the content part when active. Sets the height */
.accordion .container.active .answer {
height: 180px;
}
/* Changes from plus sign to negative sign once active */
.accordion .container.active .question::before {
content: '';
font-size: 30px;
}
</style>
<h1 class="fs-6 fw-500" align="center">Frequently Asked Questions <br> Welcome to our FAQ!</h1>
<div class="accordiobody">
{% for faq in site.data.faq_yaml.frequently_asked_questions %}
<div class="accordion">
<hr>
<div class="container">
<div class="question fw-400">
<h1 class="fs-5 fw-500">
{{ faq.question }}
</h1>
</div>
<div class="answer">
<blockquote>
<span class="answerspan{{ faq.faq_link_id }}">
{%- capture editable_part -%}
<a href="{{ faq.hyper_link }}" target="_blank">{{ faq.link_description }}</a>
{%- endcapture -%}
{% if faq.answer contains 'aaaa ' %}
{{ faq.answer | replace: 'aaaa ', editable_part }}
{% else %}
{{ faq.answer }}
{% endif %}
</span>
</blockquote>
</div>
</div>
</div>
{% endfor %}
</div>
<script type="text/javascript">
const accordion = document.getElementsByClassName('container');
for (i = 0; i < accordion.length; i++) {
accordion[i].addEventListener('click', function () {
this.classList.toggle('active');
})
}
</script>