Reply To: Changing the location of the Progress Bar

PennController for IBEX Forums Support Changing the location of the Progress Bar Reply To: Changing the location of the Progress Bar

#9919
Jeremy
Keymaster

Hi Mete,

If you want the bar’s bottom edge aligned with the bottom edge of the page’s frame as scrolled (when applicable) then you need to do this:

(()=>{
    let bar;
    (function barAsLast(){
        bar = bar || document.querySelector("#bod table:first-child");
        if (bar) {
            if (document.body.scrollHeight > window.innerHeight) {
                bar.style.position = 'unset';
                bar.style.bottom = 'unset';
                bar.style.left = 'unset';
                bar.style.transform = 'unset';
                let pc = document.querySelector("p.PennController-PennController");
                if (pc) pc.append(bar);
                else (document.querySelector("#bod table:last-child")||document.body).append(bar);
            }
            else {
                bar.style.position = 'absolute';
                bar.style.bottom = '0px';
                bar.style.left = '50vw';
                bar.style.transform = 'translateX(-50%)';
                document.body.prepend(bar);
            }
        }
        window.requestAnimationFrame(barAsLast);
    })();
})();

When there’s no vertical scroll bar, the bar will “jump” to the bottom of the visible frame, but when there is a scroll bar, then it will be placed below all the content that comes before it (ie. you’ll need to scroll down to see it)

Jeremy