MediaWiki:Common.js: Difference between revisions
MediaWiki interface page
More actions
Created page with "→Any JavaScript here will be loaded for all users on every page load.: mw.loader.load('mediawiki.page.gallery.slideshow');" |
No edit summary |
||
| Line 1: | Line 1: | ||
/* | /* Custom Slider Logic (Supports multiple sliders & custom timing) */ | ||
$(function() { | |||
$('.jule-slider').each(function() { | |||
var $slider = $(this); | |||
// Read the time from the data-interval attribute (default to 4000ms) | |||
var intervalTime = parseInt($slider.attr('data-interval')) || 4000; | |||
setInterval(function() { | |||
var $active = $slider.find('.jule-slide.active'); | |||
var $next = $active.next('.jule-slide'); | |||
// Loop back to start if at the end | |||
if ($next.length === 0) { | |||
$next = $slider.find('.jule-slide').first(); | |||
} | |||
// Swap classes to trigger CSS transitions | |||
$active.removeClass('active').css('opacity', '0'); | |||
$next.addClass('active').css('opacity', '1'); | |||
}, intervalTime); | |||
}); | |||
}); | |||
Revision as of 04:08, 27 January 2026
/* Custom Slider Logic (Supports multiple sliders & custom timing) */
$(function() {
$('.jule-slider').each(function() {
var $slider = $(this);
// Read the time from the data-interval attribute (default to 4000ms)
var intervalTime = parseInt($slider.attr('data-interval')) || 4000;
setInterval(function() {
var $active = $slider.find('.jule-slide.active');
var $next = $active.next('.jule-slide');
// Loop back to start if at the end
if ($next.length === 0) {
$next = $slider.find('.jule-slide').first();
}
// Swap classes to trigger CSS transitions
$active.removeClass('active').css('opacity', '0');
$next.addClass('active').css('opacity', '1');
}, intervalTime);
});
});