MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Manual revert |
No edit summary |
||
Line 1: | Line 1: | ||
mw.loader.using('jquery', function () { | |||
$(document).ready(function () { | |||
$('.portal .body > ul > li').each(function () { | |||
var $this = $(this); | |||
mw.loader.using( | if ($this.find('ul').length) { | ||
$this.addClass('collapsible-header'); | |||
$this.click(function (e) { | |||
// Prevent following links on header click | |||
if (e.target.tagName !== 'A') { | |||
e.preventDefault(); | |||
$this.toggleClass('open'); | |||
$this.children('ul').slideToggle(200); | |||
} | |||
}); | |||
} | |||
}); | |||
}); | }); | ||
}); | }); |
Revision as of 10:06, 25 August 2025
mw.loader.using('jquery', function () { $(document).ready(function () { $('.portal .body > ul > li').each(function () { var $this = $(this); if ($this.find('ul').length) { $this.addClass('collapsible-header'); $this.click(function (e) { // Prevent following links on header click if (e.target.tagName !== 'A') { e.preventDefault(); $this.toggleClass('open'); $this.children('ul').slideToggle(200); } }); } }); }); });