Différences entre les versions de « MediaWiki:Common.js »
Aller à la navigation
Aller à la recherche
| Ligne 6 : | Ligne 6 : | ||
$gallery.on('click', 'button[data-target]', function() { | $gallery.on('click', 'button[data-target]', function() { | ||
var target = $(this). | var target = $(this).attr('aria-controls'); | ||
console.log(target); | console.log(target); | ||
Version du 23 novembre 2023 à 20:19
$(function() {
$('.mw-information-box .mw-gallery').each(function() {
var $gallery = $(this);
var $tabs = $gallery.find('.mw-gallery-tabs button');
var $panes = $gallery.find('.mw-gallery-panes .mw-gallery-pane');
$gallery.on('click', 'button[data-target]', function() {
var target = $(this).attr('aria-controls');
console.log(target);
$tabs.each(function() {
var $this = $(this);
var active = $this.data('aria-controls') === target;
console.log(this, active);
$this
.toggleClass('active', active)
.attr('aria-selected', active ? 'true' : 'false')
;
});
$panes.each(function() {
var $this = $(this);
var active = $this.attr('id') === target;
console.log(this, active);
$this.toggleClass('active', active);
});
});
});
});