MediaWiki:Common.js: различия между версиями
Материал из wiki innovation station ss14
Userr (обсуждение | вклад) Нет описания правки |
Userr (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
mw.loader.using(['jquery'], function () { | mw.loader.using(['jquery'], function () { | ||
$(document).ready(function () { | $(document).ready(function () { | ||
$('.accordion-header' | // Добавляем обработчик для всех кнопок аккордеона | ||
$(document).on('click', '.accordion-header', function () { | |||
const $content = $(this).next('.accordion-content'); | const $content = $(this).next('.accordion-content'); | ||
const $toggle = $(this).find('.accordion-toggle'); | const $toggle = $(this).find('.accordion-toggle'); | ||
// Открываем или закрываем блок | |||
if ($content.is(':visible')) { | if ($content.is(':visible')) { | ||
$content.slideUp(); | $content.slideUp(); | ||
Версия от 18:03, 24 декабря 2024
mw.loader.using(['jquery'], function () {
$(document).ready(function () {
// Добавляем обработчик для всех кнопок аккордеона
$(document).on('click', '.accordion-header', function () {
const $content = $(this).next('.accordion-content');
const $toggle = $(this).find('.accordion-toggle');
// Открываем или закрываем блок
if ($content.is(':visible')) {
$content.slideUp();
$toggle.text('[развернуть]');
} else {
$content.slideDown();
$toggle.text('[свернуть]');
}
});
});
});
