PRACTICAL WEB TIP
Lobby Elevator — Back to the First Floor
A hotel-style floor indicator returns visitors to the opening of the page.
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-2073 / Back to Top: insert before closing body (inside footer for TB-2083) -->
<button type="button" class="tb-btt bt2073" data-backtop aria-label="ページの先頭、1階へ戻る"><span class="floor-led">1F</span><span class="floor-word">LOBBY</span><span class="floor-line"></span><span class="floor-action">PAGE TOP</span></button>
/* TB-2073 : 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}
.bt2073{position:fixed;right:22px;bottom:28px;width:70px;height:142px;border-radius:12px;background:#252b28;color:#e9e5d8;box-shadow:0 15px 26px #1118;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}
.bt2073:before{content:"";position:absolute;inset:7px;border:1px solid #9f9d7f77;border-radius:6px}
.floor-led{font:400 34px/1.1 "Courier New",monospace;color:#d7cf8e;letter-spacing:-.12em;position:relative}
.floor-word{font-size:9px;letter-spacing:.22em;position:relative}
.floor-line{width:26px;height:1px;background:#868b76;margin:5px 0}
.floor-action{font-size:8px;letter-spacing:.12em}
.bt2073:hover{background:#3a483d;transform:translateY(-6px)}
.bt2073:hover .floor-led{animation:floorflip .35s ease}
@keyframes floorflip{50%{transform:translateY(-5px);opacity:.4}}
@media (max-width:600px){.bt2073{right:14px;bottom:16px;width:63px;height:122px}}
@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
Boutique hotels, travel, hospitality.
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.