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

Перейти к навигации Перейти к поиску
310 байт добавлено ,  9 мая 2025
нет описания правки
Нет описания правки
Нет описания правки
Строка 1: Строка 1:
<includeonly>
<noinclude>
<div class="mw-collapsible mw-collapsed" style="width:100%;">
{{Documentation}}
</noinclude><includeonly>
<div class="mw-collapsible" style="width:100%;">
<div style="display:flex; justify-content:space-between; align-items:center; cursor:pointer;"  
<div style="display:flex; justify-content:space-between; align-items:center; cursor:pointer;"  
     onclick="this.querySelector('.mw-collapsible-content').classList.toggle('mw-collapsed');  
     onclick="this.nextElementSibling.style.display =
              this.nextElementSibling.style.display === 'none' ? 'block' : 'none';
               this.querySelector('.collapse-arrow').textContent =  
               this.querySelector('.collapse-arrow').textContent =  
                this.querySelector('.mw-collapsible-content').classList.contains('mw-collapsed') ? '▶' : '▼'">
              this.nextElementSibling.style.display === 'none' ? '▶' : '▼'">
<span style="font-weight:bold;">{{{1|Заголовок}}}</span>
<span style="font-weight:bold;">{{{1|Заголовок}}}</span>
<span class="collapse-arrow">▼</span>
<span class="collapse-arrow">▼</span>
</div>
</div>
<div class="mw-collapsible-content mw-collapsed" style="padding:5px 0 0 10px; display:none;">
<div style="padding:5px 0 0 10px;">
{{{2|Содержимое блока}}}
{{{2|Содержимое блока}}}
</div>
</div>
</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>

Навигация