User:RoyZuo/FooterJump.js

/*
	Adds text "Jump to Footer" next to each title to jump to page bottom.
    @Author [[User:RoyZuo]]
*/

(function addFooterScrollButton() {
    let button = document.createElement('button');
    button.innerText = 'Jump to Footer';

    // Make the button bigger by increasing the font size and padding
    button.style.fontSize = '20px';
    button.style.padding = '10px 10px';
    button.style.position = 'fixed';
    button.style.bottom = '10px';
    button.style.right = '10px';
    button.style.zIndex = '1000';
	button.style.opacity = '0.6';
	button.style.backgroundColor = 'white';
	button.style.color = 'black';

    button.addEventListener('click', function() {
        let footerPlaces = document.getElementById('footer-places');
        if (footerPlaces) {
            // Jump directly to the footer-places using scrollTo
            window.scrollTo(0, footerPlaces.offsetTop);
        }
    });
    document.body.appendChild(button);
})();