Widget:ScrollToTopFunction: Difference between revisions

From Tsadra Foundation Advanced Contemplative Scholarships
(by SublimeText.Mediawiker)
(by SublimeText.Mediawiker)
Line 1: Line 1:
<script type="text/javascript">
<script type="text/javascript">
function docReady(fn) {
function() {
    // see if DOM is already available
    if (document.readyState === "complete" || document.readyState === "interactive") {
        // call on next available tick
        setTimeout(fn, 1);
    } else {
        document.addEventListener("DOMContentLoaded", fn);
    }
}
docReady(function() {
var buttons = document.getElementsByClassName('pf-wizard-buttons a');
var buttons = document.getElementsByClassName('pf-wizard-buttons a');


Line 15: Line 6:
setTimeout(function() {window.scrollTo(0, 0); }, 300 );  
setTimeout(function() {window.scrollTo(0, 0); }, 300 );  
});
});
});
}
</script>
</script>

Revision as of 12:08, 6 June 2023

<script type="text/javascript"> function() { var buttons = document.getElementsByClassName('pf-wizard-buttons a');

buttons.on('click', function(event) { setTimeout(function() {window.scrollTo(0, 0); }, 300 ); }); } </script>