Шаблон:Collapse: различия между версиями

Перейти к навигации Перейти к поиску
624 байта убрано ,  9 мая 2025
нет описания правки
Нет описания правки
Метка: ручная отмена
Нет описания правки
 
(не показано 46 промежуточных версий этого же участника)
Строка 1: Строка 1:
<noinclude>
<includeonly>
{{Documentation}}
<div class="mw-collapsible mw-collapsed" style="width:100%; solid #aaa; margin-bottom:10px;">
</noinclude><includeonly>
  <div class="mw-collapsible-toggle" style="font-weight:bold; background:#f8f9fa; padding:5px;">
<div class="mw-collapsible" style="width:100%;">
    {{{1|Заголовок}}}
<div style="display:flex; justify-content:space-between; align-items:center; cursor:pointer;"
  </div>
    onclick="this.nextElementSibling.style.display =
  <div class="mw-collapsible-content" style="padding:10px;">
              this.nextElementSibling.style.display === 'none' ? 'block' : 'none';
    {{{2|Содержимое}}}
              this.querySelector('.collapse-arrow').textContent =
  </div>
              this.nextElementSibling.style.display === 'none' ? '▶' : '▼'">
<span style="font-weight:bold;">{{{1|Заголовок}}}</span>
<span class="collapse-arrow"></span>
</div>
</div>
<div style="padding:5px 0 0 10px;">
<div style="clear: both;"></div>  
{{{2|Содержимое блока}}}
</div>
</div>
 
<script>
// Инициализация состояния при загрузке
document.querySelectorAll('.mw-collapsible').forEach(el => {
  const content = el.querySelector('div:nth-child(2)');
  const arrow = el.querySelector('.collapse-arrow');
  content.style.display = 'none';
  arrow.textContent = '▶';
});
</script>
</includeonly>
</includeonly>

Навигация