Spaces:
Sleeping
Sleeping
Update spoller.html
Browse files- spoller.html +33 -155
spoller.html
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<style>
|
2 |
.spoiler-wrapper {
|
3 |
margin: 20px 0;
|
4 |
-
position: relative;
|
5 |
}
|
6 |
|
7 |
.spoiler-divider {
|
@@ -22,205 +21,84 @@
|
|
22 |
cursor: pointer;
|
23 |
font-size: 16px;
|
24 |
text-transform: uppercase;
|
25 |
-
|
26 |
-
transition: background-color 0.3s;
|
27 |
-
margin: 10px 0;
|
28 |
gap: 8px;
|
29 |
}
|
30 |
|
31 |
-
.spoiler1-button:hover {
|
32 |
-
background-color: #e0e0e0;
|
33 |
-
}
|
34 |
-
|
35 |
.spoiler1-content {
|
36 |
padding: 16px;
|
37 |
border: 1px solid #ddd;
|
38 |
border-top: none;
|
39 |
border-radius: 0 0 4px 4px;
|
40 |
display: none;
|
41 |
-
margin-top: -4px; /* Подтягиваем вплотную к кнопке */
|
42 |
}
|
43 |
|
44 |
.arrow {
|
45 |
-
flex-shrink: 0;
|
46 |
transition: transform 0.3s;
|
47 |
}
|
48 |
-
|
49 |
-
/* Десктопная версия (кнопка перед контентом) */
|
50 |
-
@media (min-width: 768px) {
|
51 |
-
.spoiler-desktop {
|
52 |
-
display: block;
|
53 |
-
}
|
54 |
-
.spoiler-mobile {
|
55 |
-
display: none;
|
56 |
-
}
|
57 |
-
.spoiler1-content {
|
58 |
-
margin-left: 0;
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
/* Мобильная версия (кнопка после контентом) */
|
63 |
-
@media (max-width: 767px) {
|
64 |
-
.spoiler-desktop {
|
65 |
-
display: none;
|
66 |
-
}
|
67 |
-
.spoiler-mobile {
|
68 |
-
display: flex;
|
69 |
-
flex-direction: column;
|
70 |
-
}
|
71 |
-
.spoiler-mobile .spoiler1-content {
|
72 |
-
order: 2;
|
73 |
-
border-top: 1px solid #ddd;
|
74 |
-
border-radius: 0 0 4px 4px;
|
75 |
-
margin-top: -4px;
|
76 |
-
}
|
77 |
-
.spoiler-mobile .spoiler1-button {
|
78 |
-
order: 1;
|
79 |
-
border-radius: 4px 4px 0 0;
|
80 |
-
margin-bottom: 0;
|
81 |
-
}
|
82 |
-
}
|
83 |
</style>
|
84 |
|
85 |
<div class="spoiler-divider"></div>
|
86 |
|
87 |
-
|
88 |
-
<
|
89 |
-
<button class="spoiler1-button" onclick="toggleSpoiler(this, 'desktop')" id="spoiler1ButtonDesktop">
|
90 |
-
<span class="spoiler-text">УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ</span>
|
91 |
-
<svg class="arrow" width="17" height="17" viewBox="0 0 17 17" xmlns="http://www.w3.org/2000/svg">
|
92 |
-
<path fill="none" stroke="#000000" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" d="M 3.642857 10.552631 L 8.31203 16 L 12.981202 10.552631 M 8.31203 15.221805 L 8.31203 1.214286"></path>
|
93 |
-
</svg>
|
94 |
-
</button>
|
95 |
-
<div class="spoiler1-content" id="spoiler1ContentDesktop">
|
96 |
-
<p>Это правильный ответ. Он будет скрыт до нажатия на кнопку.</p>
|
97 |
-
<p>Может содержать любой HTML-код: таблицы, изображения, списки и т.д.</p>
|
98 |
-
</div>
|
99 |
-
</div>
|
100 |
-
|
101 |
-
<!-- Мобильная версия (кнопка снизу) -->
|
102 |
-
<div class="spoiler-wrapper spoiler-mobile">
|
103 |
-
<button class="spoiler1-button" onclick="toggleSpoiler(this, 'mobile')" id="spoiler1ButtonMobile">
|
104 |
<span class="spoiler-text">УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ</span>
|
105 |
-
<svg class="arrow" width="17" height="17" viewBox="0 0 17 17"
|
106 |
-
<path fill="none" stroke="#
|
107 |
</svg>
|
108 |
</button>
|
109 |
-
<div class="spoiler1-content" id="
|
110 |
-
<p
|
111 |
-
<p>Может содержать любой HTML-код: таблицы, изображения, списки и т.д.</p>
|
112 |
</div>
|
113 |
</div>
|
114 |
|
115 |
<div class="spoiler-divider"></div>
|
116 |
|
117 |
<script>
|
118 |
-
function
|
119 |
-
const
|
120 |
-
const
|
121 |
const arrow = button.querySelector('.arrow');
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
// Синхронизация для мобильной версии
|
131 |
-
const mobileButton = document.getElementById('spoiler1ButtonMobile');
|
132 |
-
if (mobileButton) {
|
133 |
-
mobileButton.classList.toggle('active', isExpanded);
|
134 |
-
mobileButton.querySelector('.spoiler-text').textContent = isExpanded ? 'СВЕРНУТЬ' : '��ЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ';
|
135 |
-
mobileButton.querySelector('.arrow').style.transform = isExpanded ? 'rotate(180deg)' : 'rotate(0)';
|
136 |
-
document.getElementById('spoiler1ContentMobile').style.display = isExpanded ? 'block' : 'none';
|
137 |
-
}
|
138 |
-
} else {
|
139 |
-
const content = document.getElementById('spoiler1ContentMobile');
|
140 |
-
content.style.display = isExpanded ? 'block' : 'none';
|
141 |
-
|
142 |
-
// Синхронизация для десктопной версии
|
143 |
-
const desktopButton = document.getElementById('spoiler1ButtonDesktop');
|
144 |
-
if (desktopButton) {
|
145 |
-
desktopButton.classList.toggle('active', isExpanded);
|
146 |
-
desktopButton.querySelector('.spoiler-text').textContent = isExpanded ? 'СВЕРНУТЬ' : 'УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ';
|
147 |
-
desktopButton.querySelector('.arrow').style.transform = isExpanded ? 'rotate(180deg)' : 'rotate(0)';
|
148 |
-
document.getElementById('spoiler1ContentDesktop').style.display = isExpanded ? 'block' : 'none';
|
149 |
-
}
|
150 |
-
}
|
151 |
}
|
152 |
</script>
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
-
|
158 |
<div class="spoiler-divider"></div>
|
159 |
|
160 |
-
|
161 |
-
<
|
162 |
-
|
163 |
-
<
|
164 |
-
|
165 |
-
<path fill="none" stroke="#000000" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" d="M 3.642857 10.552631 L 8.31203 16 L 12.981202 10.552631 M 8.31203 15.221805 L 8.31203 1.214286"></path>
|
166 |
-
</svg>
|
167 |
-
</button>
|
168 |
-
<div class="spoiler2-content" id="spoiler2ContentDesktop">
|
169 |
-
<p>Это содержимое второго спойлера. Он будет скрыт до нажатия на кнопку.</p>
|
170 |
-
<p>Может содержать любой HTML-код: таблицы, изображения, списки и т.д.</p>
|
171 |
-
</div>
|
172 |
-
</div>
|
173 |
-
|
174 |
-
<!-- Мобильная версия второго спойлера -->
|
175 |
-
<div class="spoiler-wrapper spoiler-mobile">
|
176 |
-
<button class="spoiler2-button" onclick="toggleSpoiler2(this, 'mobile')" id="spoiler2ButtonMobile">
|
177 |
-
<span class="spoiler-text">УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ</span>
|
178 |
-
<svg class="arrow" width="17" height="17" viewBox="0 0 17 17" xmlns="http://www.w3.org/2000/svg">
|
179 |
-
<path fill="none" stroke="#000000" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" d="M 3.642857 10.552631 L 8.31203 16 L 12.981202 10.552631 M 8.31203 15.221805 L 8.31203 1.214286"></path>
|
180 |
</svg>
|
181 |
</button>
|
182 |
-
<div class="spoiler2-content" id="
|
183 |
-
<p
|
184 |
-
<p>Может содержать любой HTML-код: таблицы, изображения, списки и т.д.</p>
|
185 |
</div>
|
186 |
</div>
|
187 |
|
188 |
<div class="spoiler-divider"></div>
|
189 |
|
190 |
<script>
|
191 |
-
|
192 |
-
|
193 |
-
const
|
194 |
-
const textSpan = button.querySelector('.spoiler-text');
|
195 |
const arrow = button.querySelector('.arrow');
|
196 |
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
// Синхронизация для мобильной версии
|
205 |
-
const mobileButton = document.getElementById('spoiler2ButtonMobile'); // Изменено 1 на 2
|
206 |
-
if (mobileButton) {
|
207 |
-
mobileButton.classList.toggle('active', isExpanded);
|
208 |
-
mobileButton.querySelector('.spoiler-text').textContent = isExpanded ? 'СВЕРНУТЬ' : 'УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ';
|
209 |
-
mobileButton.querySelector('.arrow').style.transform = isExpanded ? 'rotate(180deg)' : 'rotate(0)';
|
210 |
-
document.getElementById('spoiler2ContentMobile').style.display = isExpanded ? 'block' : 'none'; // Изменено 1 на 2
|
211 |
-
}
|
212 |
-
} else {
|
213 |
-
const content = document.getElementById('spoiler2ContentMobile'); // Изменено 1 на 2
|
214 |
-
content.style.display = isExpanded ? 'block' : 'none';
|
215 |
-
|
216 |
-
// Синхронизация для десктопной версии
|
217 |
-
const desktopButton = document.getElementById('spoiler2ButtonDesktop'); // Изменено 1 на 2
|
218 |
-
if (desktopButton) {
|
219 |
-
desktopButton.classList.toggle('active', isExpanded);
|
220 |
-
desktopButton.querySelector('.spoiler-text').textContent = isExpanded ? 'СВЕРНУТЬ' : 'УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ';
|
221 |
-
desktopButton.querySelector('.arrow').style.transform = isExpanded ? 'rotate(180deg)' : 'rotate(0)';
|
222 |
-
document.getElementById('spoiler2ContentDesktop').style.display = isExpanded ? 'block' : 'none'; // Изменено 1 на 2
|
223 |
-
}
|
224 |
-
}
|
225 |
}
|
226 |
-
</script>
|
|
|
1 |
<style>
|
2 |
.spoiler-wrapper {
|
3 |
margin: 20px 0;
|
|
|
4 |
}
|
5 |
|
6 |
.spoiler-divider {
|
|
|
21 |
cursor: pointer;
|
22 |
font-size: 16px;
|
23 |
text-transform: uppercase;
|
24 |
+
transition: all 0.3s;
|
|
|
|
|
25 |
gap: 8px;
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
28 |
.spoiler1-content {
|
29 |
padding: 16px;
|
30 |
border: 1px solid #ddd;
|
31 |
border-top: none;
|
32 |
border-radius: 0 0 4px 4px;
|
33 |
display: none;
|
|
|
34 |
}
|
35 |
|
36 |
.arrow {
|
|
|
37 |
transition: transform 0.3s;
|
38 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
</style>
|
40 |
|
41 |
<div class="spoiler-divider"></div>
|
42 |
|
43 |
+
<div class="spoiler-wrapper">
|
44 |
+
<button class="spoiler1-button" onclick="toggleSpoiler1()" id="spoiler1Button">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
<span class="spoiler-text">УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ</span>
|
46 |
+
<svg class="arrow" width="17" height="17" viewBox="0 0 17 17">
|
47 |
+
<path fill="none" stroke="#000" stroke-width="1.7" d="M3.6 10.6L8.3 16l4.7-5.4M8.3 15.2V1.2"/>
|
48 |
</svg>
|
49 |
</button>
|
50 |
+
<div class="spoiler1-content" id="spoiler1Content">
|
51 |
+
<p>Контент первого спойлера</p>
|
|
|
52 |
</div>
|
53 |
</div>
|
54 |
|
55 |
<div class="spoiler-divider"></div>
|
56 |
|
57 |
<script>
|
58 |
+
function toggleSpoiler1() {
|
59 |
+
const button = document.getElementById('spoiler1Button');
|
60 |
+
const content = document.getElementById('spoiler1Content');
|
61 |
const arrow = button.querySelector('.arrow');
|
62 |
|
63 |
+
const isExpanded = content.style.display === 'block';
|
64 |
+
content.style.display = isExpanded ? 'none' : 'block';
|
65 |
+
arrow.style.transform = isExpanded ? 'rotate(0)' : 'rotate(180deg)';
|
66 |
+
button.querySelector('.spoiler-text').textContent = isExpanded
|
67 |
+
? 'УЗНАТЬ ПРАВИЛЬНЫЙ ОТВЕТ'
|
68 |
+
: 'СВЕРНУТЬ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
</script>
|
71 |
|
72 |
|
73 |
|
74 |
|
|
|
75 |
<div class="spoiler-divider"></div>
|
76 |
|
77 |
+
<div class="spoiler-wrapper">
|
78 |
+
<button class="spoiler2-button" onclick="toggleSpoiler2()" id="spoiler2Button">
|
79 |
+
<span class="spoiler-text">УЗНАТЬ ДОПОЛНЕНИЕ</span>
|
80 |
+
<svg class="arrow" width="17" height="17" viewBox="0 0 17 17">
|
81 |
+
<path fill="none" stroke="#000" stroke-width="1.7" d="M3.6 10.6L8.3 16l4.7-5.4M8.3 15.2V1.2"/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
</svg>
|
83 |
</button>
|
84 |
+
<div class="spoiler2-content" id="spoiler2Content">
|
85 |
+
<p>Контент второго спойлера</p>
|
|
|
86 |
</div>
|
87 |
</div>
|
88 |
|
89 |
<div class="spoiler-divider"></div>
|
90 |
|
91 |
<script>
|
92 |
+
function toggleSpoiler2() {
|
93 |
+
const button = document.getElementById('spoiler2Button');
|
94 |
+
const content = document.getElementById('spoiler2Content');
|
|
|
95 |
const arrow = button.querySelector('.arrow');
|
96 |
|
97 |
+
const isExpanded = content.style.display === 'block';
|
98 |
+
content.style.display = isExpanded ? 'none' : 'block';
|
99 |
+
arrow.style.transform = isExpanded ? 'rotate(0)' : 'rotate(180deg)';
|
100 |
+
button.querySelector('.spoiler-text').textContent = isExpanded
|
101 |
+
? 'УЗНАТЬ ДОПОЛНЕНИЕ'
|
102 |
+
: 'СВЕРНУТЬ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
+
</script>
|