MediaWiki: Vector.js: Unterschied zwischen den Versionen
Aus UDI
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung Markierung: Zurückgesetzt |
||
| Zeile 2: | Zeile 2: | ||
$(document).ready(function() { | $(document).ready(function() { | ||
function activateTab(target) { | |||
if (target) { | if (target) { | ||
$('.nav-tabs li a, .nav-tabs li span').removeClass('active'); | $('.nav-tabs li a, .nav-tabs li span').removeClass('active'); | ||
$('.tab-content .tab-pane').removeClass('active'); | $('.tab-content .tab-pane').removeClass('active'); | ||
$(target).addClass('active'); // | |||
$('.nav-tabs li a[href="' + target + '"], .nav-tabs li span[data-target="' + target + '"]').addClass('active'); | |||
// Aktiviere den entsprechenden Tab-Inhalt | |||
$(target).addClass('active'); | |||
} | } | ||
}); | } | ||
// Klick-Ereignis für Tabs | |||
$('.nav-tabs li a, .nav-tabs li span[data-target]').click(function(e) { | |||
var target = $(this).attr('href') || $(this).attr('data-target'); | |||
if (target.startsWith("#")) { | |||
e.preventDefault(); | |||
activateTab(target); | |||
history.pushState(null, null, target); | |||
} | |||
}); | }); | ||
if (window.location.hash) { | |||
activateTab(window.location.hash); | |||
} | |||
}); | }); | ||
Version vom 20. März 2025, 12:02 Uhr
/* Das folgende JavaScript wird für Benutzer der Vector-Benutzeroberfläche geladen. */
$(document).ready(function() {
function activateTab(target) {
if (target) {
$('.nav-tabs li a, .nav-tabs li span').removeClass('active');
$('.tab-content .tab-pane').removeClass('active');
$('.nav-tabs li a[href="' + target + '"], .nav-tabs li span[data-target="' + target + '"]').addClass('active');
// Aktiviere den entsprechenden Tab-Inhalt
$(target).addClass('active');
}
}
// Klick-Ereignis für Tabs
$('.nav-tabs li a, .nav-tabs li span[data-target]').click(function(e) {
var target = $(this).attr('href') || $(this).attr('data-target');
if (target.startsWith("#")) {
e.preventDefault();
activateTab(target);
history.pushState(null, null, target);
}
});
if (window.location.hash) {
activateTab(window.location.hash);
}
});