MediaWiki:Common.js
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
/* JS für interaktive Reiter (Tabs) */
$(document).ready(function() {
// Suchen nach allen Tab-Containern im Wiki
$('.mw-tabs').each(function() {
var $container = $(this);
var $navItems = $container.find('.mw-tabs-nav li');
var $contentItems = $container.find('.mw-tabs-content .tab-pane');
// Den ersten Reiter standardmäßig aktivieren
$navItems.first().addClass('active-tab').css({'background': '#fff', 'border-bottom': '1px solid #fff', 'margin-bottom': '-1px'});
$contentItems.hide().first().show();
// Klick-Event für die Reiter
$navItems.click(function() {
var $clickedTab = $(this);
var index = $clickedTab.index();
// Setze das Design aller Reiter zurück
$navItems.removeClass('active-tab').css({'background': '#f8f9fa', 'border-bottom': '1px solid #a2a9b1', 'margin-bottom': '0'});
// Hebe den geklickten Reiter hervor
$clickedTab.addClass('active-tab').css({'background': '#fff', 'border-bottom': '1px solid #fff', 'margin-bottom': '-1px'});
// Blende den alten Inhalt aus und den neuen ein
$contentItems.hide();
$contentItems.eq(index).fadeIn(150);
});
});
});
