MediaWiki:Common.js
MediaWiki interface page
More actions
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.
/* 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);
});
});