File size: 5,814 Bytes
f0399f0
c31af01
8d20045
 
508376f
 
8d20045
 
 
 
e21b5a1
8d20045
 
e21b5a1
8d20045
e21b5a1
8d20045
e21b5a1
 
 
 
8d20045
 
508376f
 
8d20045
 
 
508376f
 
e21b5a1
8d20045
 
e21b5a1
8d20045
 
 
 
 
 
 
e21b5a1
508376f
 
e21b5a1
508376f
e21b5a1
8d20045
 
508376f
 
e21b5a1
 
 
8d20045
 
508376f
 
e21b5a1
 
c31af01
8d20045
e21b5a1
8d20045
 
508376f
 
e21b5a1
 
 
 
 
 
 
 
 
c31af01
8d20045
f0399f0
81a53ca
d5231be
508376f
adf9c34
c31af01
4e7cf82
 
c31af01
4e7cf82
 
c31af01
 
4e7cf82
 
c31af01
 
 
adf9c34
 
c31af01
 
4e7cf82
 
 
c31af01
 
4e7cf82
 
 
 
 
 
c31af01
 
 
 
508376f
adf9c34
c31af01
4e7cf82
 
 
 
 
c31af01
 
4e7cf82
 
c31af01
 
 
adf9c34
 
c31af01
 
4e7cf82
 
 
c31af01
 
4e7cf82
 
 
 
 
 
c31af01
5651826
 
 
508376f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bafff21
5651826
bafff21
5651826
bafff21
5651826
bafff21
5651826
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

<style>
/* УНИВЕРСАЛЬНЫЕ СТИЛИ */
.spoiler1-button, 
.spoiler2-button,
.spoiler3-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 16px;
  background-color: #f5f5f5;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: background-color 0.3s;
  margin: 10px 0;
  gap: 8px;
}
.spoiler1-button:hover,
.spoiler2-button:hover,
.spoiler3-button:hover {
  background-color: #e0e0e0;
}
.spoiler1-content,
.spoiler2-content,
.spoiler3-content {
  padding: 16px;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  display: none;
  margin-top: -4px;
}
.arrow {
  flex-shrink: 0;
  transition: transform 0.3s;
}
/* серые линии сверху и снизу */
.spoiler-divider {
  border-bottom: 1px solid #ccc;
  margin: 10px 0;
}
/* 📱 Телефон (до 767px) */
@media (max-width: 767px) {
  .spoiler1-button,
  .spoiler2-button,
  .spoiler3-button {
    font-size: 18px;     /* крупнее текст */
    padding: 16px 20px;  /* больше зона клика */
    gap: 10px;
  }
  .spoiler1-content,
  .spoiler2-content,
  .spoiler3-content {
    font-size: 16px;
    padding: 14px;
  }
}
/* 📱📲 Планшет (768px – 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .spoiler1-button,
  .spoiler2-button,
  .spoiler3-button {
    font-size: 17px;
    padding: 14px 18px;
    gap: 9px;
  }
  .spoiler1-content,
  .spoiler2-content,
  .spoiler3-content {
    font-size: 15px;
    padding: 14px;
  }
}
</style>


<!--  Первый блок -->
<div class="spoiler-divider"></div> <!-- верхняя линия -->

<div class="spoiler-wrapper">
  <button class="spoiler1-button" onclick="toggleSpoiler1()" id="spoiler1Button">
    <span class="spoiler-text">УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ</span>
    <svg class="arrow" width="17" height="17" viewBox="0 0 17 17">
      <path fill="none" stroke="#000" stroke-width="1.7" d="M3.6 10.6L8.3 16l4.7-5.4M8.3 15.2V1.2"/>
    </svg>
  </button>
  <div class="spoiler1-content" id="spoiler1Content">
    <p>Контент первого спойлера</p>
  </div>
</div>

<div class="spoiler-divider"></div> <!-- нижняя линия -->


<script>
  function toggleSpoiler1() {
    const button = document.getElementById('spoiler1Button');
    const content = document.getElementById('spoiler1Content');
    const arrow = button.querySelector('.arrow');
    
    const isExpanded = content.style.display === 'block';
    content.style.display = isExpanded ? 'none' : 'block';
    arrow.style.transform = isExpanded ? 'rotate(0)' : 'rotate(180deg)';
    button.querySelector('.spoiler-text').textContent = isExpanded 
      ? 'УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ' 
      : 'СВЕРНУТЬ';
  }
</script>


<!--  Второй блок -->
<div class="spoiler-divider"></div> <!-- верхняя линия -->

<div class="spoiler-wrapper">
  <button class="spoiler2-button" onclick="toggleSpoiler2()" id="spoiler2Button">
    <span class="spoiler-text">УЗНАТЬ ДОПОЛНЕНИЕ</span>
    <svg class="arrow" width="17" height="17" viewBox="0 0 17 17">
      <path fill="none" stroke="#000" stroke-width="1.7" d="M3.6 10.6L8.3 16l4.7-5.4M8.3 15.2V1.2"/>
    </svg>
  </button>
  <div class="spoiler2-content" id="spoiler2Content">
    <p>Контент второго спойлера</p>
  </div>
</div>

<div class="spoiler-divider"></div> <!-- нижняя линия -->


<script>
  function toggleSpoiler2() {
    const button = document.getElementById('spoiler2Button');
    const content = document.getElementById('spoiler2Content');
    const arrow = button.querySelector('.arrow');
    
    const isExpanded = content.style.display === 'block';
    content.style.display = isExpanded ? 'none' : 'block';
    arrow.style.transform = isExpanded ? 'rotate(0)' : 'rotate(180deg)';
    button.querySelector('.spoiler-text').textContent = isExpanded 
      ? 'УЗНАТЬ ДОПОЛНЕНИЕ' 
      : 'СВЕРНУТЬ';
  }
</script>


<!--  Третий блок (пример) -->
<div class="spoiler-divider"></div> <!-- верхняя линия -->

<div class="spoiler-wrapper">
  <button class="spoiler3-button" onclick="toggleSpoiler3()" id="spoiler3Button">
    <span class="spoiler-text">ТРЕТИЙ СПОЙЛЕР</span>
    <svg class="arrow" width="17" height="17" viewBox="0 0 17 17">
      <path fill="none" stroke="#000" stroke-width="1.7" d="M3.6 10.6L8.3 16l4.7-5.4M8.3 15.2V1.2"/>
    </svg>
  </button>
  <div class="spoiler3-content" id="spoiler3Content">
    <p>Контент третьего спойлера</p>
  </div>
</div>

<div class="spoiler-divider"></div> <!-- нижняя линия -->


<script>
  function toggleSpoiler3() {
    const button = document.getElementById('spoiler3Button');
    const content = document.getElementById('spoiler3Content');
    const arrow = button.querySelector('.arrow');
    
    const isExpanded = content.style.display === 'block';
    content.style.display = isExpanded ? 'none' : 'block';
    arrow.style.transform = isExpanded ? 'rotate(0)' : 'rotate(180deg)';
    button.querySelector('.spoiler-text').textContent = isExpanded 
      ? 'ТРЕТИЙ СПОЙЛЕР' 
      : 'СВЕРНУТЬ';
  }
</script>


<!--  Для третьего  -->

<!--  1) Добавляем через запятую в стили класс .spoiler3-button  --> 

<!-- 2) Копируем HTML код изменяем внутри текст и номер в классе и ИД блока на 3  -->

<!--  2) Копируем JS код изменяем внутри номер в классе и ИД блока на 3  -->