Différences entre les versions de « MediaWiki:Common.js »
Aller à la navigation
Aller à la recherche
Ligne 7 : | Ligne 7 : | ||
$gallery.on('click', 'button[data-target]', function() { | $gallery.on('click', 'button[data-target]', function() { | ||
var target = $(this).attr('aria-controls'); | var target = $(this).attr('aria-controls'); | ||
$tabs.each(function() { | $tabs.each(function() { | ||
var $this = $(this); | var $this = $(this); | ||
var active = $this.data('aria-controls') === target; | var active = $this.data('aria-controls') === target; | ||
$this | $this | ||
Ligne 23 : | Ligne 21 : | ||
var $this = $(this); | var $this = $(this); | ||
var active = $this.attr('id') === target; | var active = $this.attr('id') === target; | ||
$this.toggleClass('active', active); | $this.toggleClass('active', active); | ||
}); | }); |
Version du 23 novembre 2023 à 21:20
$(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'); $tabs.each(function() { var $this = $(this); var active = $this.data('aria-controls') === target; $this .toggleClass('active', active) .attr('aria-selected', active ? 'true' : 'false') ; }); $panes.each(function() { var $this = $(this); var active = $this.attr('id') === target; $this.toggleClass('active', active); }); }); }); });