PRACTICAL WEB TIP
Insert Coin Reset — Restart Page
An arcade-inspired restart control returns the visitor to the start.
Design Preview
See the design above before trying the scroll interaction.
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.
<!-- TB-2077 / Back to Top: insert before closing body (inside footer for TB-2083) -->
<button class="tb-btt bt2077" data-backtop type="button" aria-label="ゲームの始まり、ページの先頭へ戻る"><span class="game-light"></span><span class="game-word">RE<br>START</span><span class="game-tiny">BACK TO LEVEL 01</span></button>
/* TB-2077 : paste only this CSS into the target page. */
.tb-btt{border:0;cursor:pointer;z-index:30;-webkit-tap-highlight-color:transparent;touch-action:manipulation;transition:transform .35s,opacity .3s,background .3s,color .3s,box-shadow .3s;pointer-events:none;opacity:0;visibility:hidden}.tb-btt.is-visible{pointer-events:auto;opacity:1;visibility:visible}.tb-btt:focus-visible{outline:3px solid #f9af4b;outline-offset:5px}.only-at-end{opacity:1;visibility:visible;pointer-events:auto}
@keyframes orbitTurn{to{transform:rotate(360deg)}}
.bt2077{position:fixed;left:22px;bottom:25px;width:116px;height:102px;border-radius:18px;background:#faea68;border:4px solid #22183c;color:#21133b;box-shadow:0 12px 0 #cc4692,0 23px 30px #0008;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:3px;transform-origin:bottom left}
.game-light{position:absolute;right:9px;top:9px;width:9px;height:9px;background:#ff5c8d;border-radius:50%;box-shadow:0 0 0 4px #fc8fab60;animation:blink 2.4s infinite}
.game-word{font-size:23px;line-height:.85;font-weight:950;letter-spacing:-.05em}
.game-tiny{font-size:7px;letter-spacing:.07em;font-weight:900;margin-top:6px}
@keyframes blink{50%{opacity:.25}}
.bt2077:hover{transform:translateY(-8px);background:#96fbe4;box-shadow:0 12px 0 #574bdb,0 23px 30px #0008}
@media (max-width:700px){.bt2077{width:97px;height:92px;left:12px;bottom:16px}.game-word{font-size:19px}}
@media(prefers-reduced-motion:reduce){.tb-btt,.tb-btt *{animation-duration:.01ms!important;transition-duration:.01ms!important}}
(()=>{'use strict';const control=document.querySelector('[data-backtop]');if(!control)return;const reduced=matchMedia('(prefers-reduced-motion: reduce)');const footer=control.classList.contains('only-at-end');let busy=false;function refresh(){busy=false;const max=Math.max(1,document.documentElement.scrollHeight-window.innerHeight);const p=Math.min(1,scrollY/max);document.documentElement.style.setProperty('--page-progress',p.toFixed(4));if(!footer){const show=scrollY>145;control.classList.toggle('is-visible',show);control.tabIndex=show?0:-1;control.setAttribute('aria-hidden',String(!show));}const number=document.querySelector('[data-progress-number]');if(number)number.textContent=Math.round(p*100)+'%';}function onscroll(){if(!busy){busy=true;requestAnimationFrame(refresh)}}addEventListener('scroll',onscroll,{passive:true});addEventListener('resize',onscroll,{passive:true});control.addEventListener('click',()=>window.scrollTo({top:0,behavior:reduced.matches?'instant':'smooth'}));refresh();})();
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
Games, pop-up exhibits and creative campaigns.
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.