Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
 
Line 20: Line 20:
              
              
         }, intervalTime);
         }, intervalTime);
    });
});
/* Infobox Tab Logic */
$(function() {
    // When a tab button is clicked...
    $('.infobox-tab-btn').on('click', function() {
        var $btn = $(this);
        var targetId = $btn.attr('data-target');
        var $container = $btn.closest('.infobox-image-area');
        // 1. Remove 'active' from all buttons in this infobox
        $container.find('.infobox-tab-btn').removeClass('active');
       
        // 2. Hide all images in this infobox
        $container.find('.infobox-img-content').removeClass('active');
        // 3. Make the clicked button active
        $btn.addClass('active');
       
        // 4. Show the target image
        $container.find('#' + targetId).addClass('active');
     });
     });
});
});

Latest revision as of 19:26, 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);
    });
});

/* Infobox Tab Logic */
$(function() {
    // When a tab button is clicked...
    $('.infobox-tab-btn').on('click', function() {
        var $btn = $(this);
        var targetId = $btn.attr('data-target');
        var $container = $btn.closest('.infobox-image-area');

        // 1. Remove 'active' from all buttons in this infobox
        $container.find('.infobox-tab-btn').removeClass('active');
        
        // 2. Hide all images in this infobox
        $container.find('.infobox-img-content').removeClass('active');

        // 3. Make the clicked button active
        $btn.addClass('active');
        
        // 4. Show the target image
        $container.find('#' + targetId).addClass('active');
    });
});