-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfaq.liquid
164 lines (156 loc) · 4.46 KB
/
faq.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{% if section.settings.title != blank %}
<div class="page-width">
<div class="title-holder">
<h2>{{ section.settings.title | escape }}</h2>
<p class="faq-subtitle">{{ section.settings.subtitle }}</p>
</div>
</div>
{% endif %}
<!--/ By dfeault the answers are hidden and jquery used below will toggle on click-->
<style type="text/css">
.faq-answer{display:none;}
.faq-question {
font-size: 18px;
font-weight: bold;
margin-top: 12px;
background: #ececec;
padding: 20px;
border: 1px solid #eaeaea;
cursor: pointer;
}.faq-question span {
display: inline-block;
float: right;
height: 25px;
width: 25px;
background: #bdbdbd;
text-align: center;
border-radius: 50%;
text-align: center;
color: white;
}.faq-answer {
background: white;
padding: 20px 30px 30px;
box-shadow: 5px 5px 65px #e7e7e7;
margin-bottom: 25px;
}
.faq-wrapper .faq-question span i {
text-stroke: 1px #bdbdbd;
-webkit-text-stroke: 1px #bdbdbd;
-moz-text-stroke: 1px #bdbdbd;
-ms-text-stroke: 1px #bdbdbd;
font-size: 15px;
}.faq-wrapper .faq-question span {
line-height: 23px;
}
</style>
<div class="page-width" data-section-id="{{ section.id }}">
{% if section.blocks.size > 0 %}
<div class="faq-wrapper">
{% for block in section.blocks %}
<div class="faq--{{ block.id }}" {{ block.shopify_attributes }}>
<div class="faq-individual">
{% if block.settings.question != blank %}
<div class="faq-question">{{ block.settings.question }} <span><i class="fa fa-plus"></i></span></div>
{% endif %}
{% if block.settings.answer != blank %}
<div class="faq-answer">{{ block.settings.answer }}</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if section.blocks.size == 0 %}
{% include 'no-blocks' %}
{% endif %}
<!--/ Extra info to showcase like if you don't find contact us to this email address -->
{% if section.settings.faq_footer_title != blank %}
<div class="faq-footer-title"><h3>{{ section.settings.faq_footer_title }}</h3></div>
{% endif %}
{% if section.settings.faq_footer_email != blank %}
<div class="faq-footer-email"><a href="mailto:{{ section.settings.faq_footer_email }}">{{ section.settings.faq_footer_email }}</a></div>
{% endif %}
</div>
<!--/ Script for toggle of question/answer. It is using font awesome for plus on unopen state and minus on opened state -->
<script type="text/javascript">
jQuery('.faq-question').click(function(){
jQuery(this).siblings('.faq-answer').slideToggle();
jQuery(this).parent().toggleClass('open-state');
if(jQuery(this).find('.fa').hasClass('fa-plus')){
jQuery(this).find('.fa').removeClass('fa-plus');
jQuery(this).find('.fa').addClass('fa-minus');
}else if(jQuery(this).find('.fa').hasClass('fa-minus')){
jQuery(this).find('.fa').removeClass('fa-minus');
jQuery(this).find('.fa').addClass('fa-plus');
}
});
</script>
{% schema %}
{
"name": "FAQ",
"class": "index-section",
"settings": [
{
"type": "text",
"id": "title",
"label": "FAQ page heading",
"default": "FAQ"
},
{
"type": "text",
"id": "subtitle",
"label": "FAQ page subtitle",
"default": "FAQ Subtitle"
},
{
"type": "text",
"id": "faq_footer_title",
"label": "Footer title",
"default": "If you can’t find answer for your quesion, contact us"
},
{
"type": "text",
"id": "faq_footer_email",
"label": "Footer email",
"default": "[email protected]"
}
],
"blocks": [
{
"type": "text_block",
"name": "Item",
"settings": [
{
"type": "text",
"id": "question",
"label": "Question",
"default": "Add Question"
},
{
"type": "richtext",
"id": "answer",
"label": "Add answer",
"default": "<p>Add Answer</p>"
}
]
}
],
"presets": [
{
"name": "FAQ",
"category": "Text",
"blocks": [
{
"type": "text_block"
},
{
"type": "text_block"
},
{
"type": "text_block"
}
]
}
]
}
{% endschema %}