Jump to content

MediaWiki:Common.js: Difference between revisions

From Transight Wiki
No edit summary
Tag: Manual revert
No edit summary
Line 6: Line 6:
$(document).ready(function () {
$(document).ready(function () {
     $("a.external").attr("target", "_blank");
     $("a.external").attr("target", "_blank");
});
// Scrolling style
$(document).ready(function () {
    $('a[href*="#"]:not([href="#"])').on('click', function (e) {
        var targetId = this.hash.slice(1);
        var target = document.getElementById(targetId);
        if (target) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $(target).offset().top
            }, 500); // 500ms scroll duration
        }
    });
});
});

Revision as of 12:10, 6 August 2025

$(document).ready(function() {
  $('input#searchInput').attr('placeholder', 'Search for Transight Wiki');
});

// Open all external links in a new tab
$(document).ready(function () {
    $("a.external").attr("target", "_blank");
});

// Scrolling style 
$(document).ready(function () {
    $('a[href*="#"]:not([href="#"])').on('click', function (e) {
        var targetId = this.hash.slice(1);
        var target = document.getElementById(targetId);

        if (target) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $(target).offset().top
            }, 500); // 500ms scroll duration
        }
    });
});