TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Progress Column — Scroll Reset

A vertical progress indicator turns into a reset-to-start interaction.

Design Preview

See the design above before trying the scroll interaction.

LOOK CLOSELY
IN PAGE CONTEXT

Live Demo

Press Try scrolling inside the frame, or scroll inside it. The button appears at the lower right and returns you to the top.

Source Code

Copy the HTML, CSS or JavaScript you need for your project.

HTML
<!-- TB-2072 / Progress Column / スクロール量 | paste before the closing body tag (inside the footer for TB-2069) -->
<button aria-label="ページの先頭へ戻る" class="btt progress tb-btt-2072" type="button"><span class="prg-label">RESET</span><span class="prg-track"><i class="prg-fill"></i></span><span class="prg-count" data-progress="">00%</span></button>
CSS
/* 2072 / production button rules only */
.tb-btt-2072{box-sizing:border-box;font:inherit;cursor:pointer}.tb-btt-2072 :is(span,i,em,b,small,img){box-sizing:border-box}
.btt.tb-btt-2072{position:fixed;z-index:90;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .28s ease,visibility .28s ease,transform .35s ease}.btt.tb-btt-2072:focus-visible{outline:3px solid #f0af43;outline-offset:5px}.tb-btt-2072 .progress{right:18px;bottom:18px;width:78px;height:191px;background:#d1dbd1;color:#213a2a;border:1px solid #839b85;box-shadow:0 10px 25px #0003;display:flex;align-items:center;flex-direction:column;padding:13px 8px 10px;justify-content:space-between}.tb-btt-2072 .prg-label{font:800 10px/1 Arial;letter-spacing:.17em}.tb-btt-2072 .prg-track{position:relative;flex:1;width:8px;background:repeating-linear-gradient(0deg,#93a899 0 2px,#c0d1c1 2px 8px);margin:17px 0 12px;border-radius:8px;overflow:hidden}.tb-btt-2072 .prg-fill{position:absolute;inset:auto 0 0;height:calc(var(--pct,0) * 100%);background:#294b36;transition:height .15s linear}.tb-btt-2072 .prg-count{font:600 16px/1 Georgia,serif}.tb-btt-2072 .progress:hover{background:#284c35;color:#f3f5ec}.tb-btt-2072 .progress:hover .prg-track{background:#7c9a7e}.tb-btt-2072 .progress:hover .prg-fill{background:#e9ad59}@media  (max-width:600px){.tb-btt-2072 .progress{right:12px;bottom:16px;width:67px;height:163px}}

@media(prefers-reduced-motion:reduce){.tb-btt-2072,.tb-btt-2072 *{animation-duration:.01ms!important;transition-duration:.01ms!important}}
JavaScript
(()=>{'use strict';const target=document.querySelector('.btt, .footer-return');if(!target)return;const isFooter=target.classList.contains('footer-return');const reduced=matchMedia('(prefers-reduced-motion: reduce)');let active=false;const update=()=>{const y=window.scrollY;const p=Math.max(0,Math.min(1,y/Math.max(1,document.documentElement.scrollHeight-innerHeight)));if(!isFooter){const visible=y>160;target.classList.toggle('is-visible',visible);target.setAttribute('aria-hidden',String(!visible));target.tabIndex=visible?0:-1;}target.style.setProperty('--pct',p.toFixed(3));const txt=target.querySelector('[data-progress]');if(txt)txt.textContent=String(Math.round(100*p)).padStart(2,'0')+'%';};const scroll=()=>{if(active)return;active=true;requestAnimationFrame(()=>{active=false;update()})};target.addEventListener('click',()=>window.scrollTo({top:0,behavior:reduced.matches?'instant':'smooth'}));addEventListener('scroll',scroll,{passive:true});addEventListener('resize',scroll,{passive:true});update();})();

How to Use

Insert the HTML button near the end of body, load the CSS, and include JavaScript using defer. Test scrolling, returning to the top, and positioning on mobile.

Use Case

Process journals and industrial design sites.

Technical Notes

Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.

Mobile:Check tap target, visibility and positioning on small screens.

Browser:Designed for current Chrome, Edge, Firefox and Safari.

Reduced Motion:CSS animations respect the reduced-motion preference.