MediaWiki:Common.js: Unterschied zwischen den Versionen

Aus DG HochN-Wiki
Wechseln zu:Navigation, Suche
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 3: Zeile 3:
/* Offset für fixed Navigation bei Ankerlinks */
/* Offset für fixed Navigation bei Ankerlinks */
(function($, window) {
(function($, window) {
        var adjustAnchor = function() {
    var adjustAnchor = function() {
        var $anchor = $(':target'),
            fixedElementHeight = 100;
        if ($anchor.length > 0) {
            window.scrollTo(0, $anchor.offset().top - fixedElementHeight);
        }
    };
    $(window).on('hashchange load', function() {
        adjustAnchor();
    });
})(jQuery, window);


            var $anchor = $(':target'),
/* Dynamische URL für den "Zum Bearbeitungsfeld gehen"-Link */
                    fixedElementHeight = 100;
(function($) {
 
    $(document).ready(function() {
            if ($anchor.length > 0) {
        $('.mw-continue-editing a[href="#editform"]').each(function() {
               
             $(this).attr('href', window.location.href);
                /* With animation */
                // $('html, body')
                  // .stop()
                  // .animate({
                    // scrollTop: $anchor.offset().top - fixedElementHeight
                  // }, 200);
 
                /* Without animation */
                window.scrollTo(0, $anchor.offset().top - fixedElementHeight);
 
             }
 
        };
 
        $(window).on('hashchange load', function() {
            adjustAnchor();
         });
         });
 
    });
    })(jQuery, window);
})(jQuery);

Version vom 6. November 2025, 10:40 Uhr

/* Das folgende JavaScript wird für alle Benutzer geladen. */

/* Offset für fixed Navigation bei Ankerlinks */
(function($, window) {
    var adjustAnchor = function() {
        var $anchor = $(':target'),
            fixedElementHeight = 100;
        if ($anchor.length > 0) {
            window.scrollTo(0, $anchor.offset().top - fixedElementHeight);
        }
    };
    $(window).on('hashchange load', function() {
        adjustAnchor();
    });
})(jQuery, window);

/* Dynamische URL für den "Zum Bearbeitungsfeld gehen"-Link */
(function($) {
    $(document).ready(function() {
        $('.mw-continue-editing a[href="#editform"]').each(function() {
            $(this).attr('href', window.location.href);
        });
    });
})(jQuery);
Cookies helfen uns bei der Bereitstellung von DG HochN-Wiki. Durch die Nutzung von DG HochN-Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.