MediaWiki:Common.js: Difference between revisions
No edit summary |
mNo edit summary Tag: Reverted |
||
| Line 107: | Line 107: | ||
update(); | update(); | ||
}); | }); | ||
}); | |||
/* ========================================================= | |||
OOO FAQ – True Accordion Control | |||
========================================================= */ | |||
mw.hook('wikipage.content').add(function ($content) { | |||
$content.find('.ooo-faq__item').each(function () { | |||
var $item = $(this); | |||
// Ensure collapsible initialized | |||
if (!$item.hasClass('mw-collapsible')) return; | |||
// Click handler for accordion behavior | |||
$item.on('click', '.ooo-faq__question', function () { | |||
// If already open, do nothing (allow collapse normally) | |||
if (!$item.hasClass('mw-collapsed')) { | |||
// Close all other FAQ items | |||
$content.find('.ooo-faq__item').not($item).each(function () { | |||
var $other = $(this); | |||
if (!$other.hasClass('mw-collapsed')) { | |||
$other.find('.mw-collapsible-toggle').trigger('click'); | |||
} | |||
}); | |||
} | |||
}); | |||
}); | |||
}); | }); | ||