PRACTICAL WEB TIP
Curtain Call — Return to Opening
A theatre pull cord invites visitors to return to the opening scene.
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-2074 / Back to Top: insert before closing body (inside footer for TB-2083) -->
<button class="tb-btt bt2074" data-backtop type="button" aria-label="舞台の開幕、ページの先頭へ戻る"><span class="cord"></span><span class="pull">幕開けへ</span><span class="tassel"></span></button>
/* TB-2074 : 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}
.bt2074{position:fixed;left:25px;top:41%;width:95px;height:165px;background:transparent;color:#f3d4a2;display:flex;align-items:center;flex-direction:column}
.cord{display:block;width:3px;height:70px;background:linear-gradient(#ae8970,#ffdc9e);transform-origin:top;animation:cordSway 4.5s ease-in-out infinite}
.pull{font-size:12px;padding:9px 8px;background:#6e2039;border:1px solid #d49e79;border-radius:4px;writing-mode:vertical-rl;letter-spacing:.2em;min-height:61px;box-shadow:0 10px 20px #0005}
.tassel{width:16px;height:17px;border-radius:5px 5px 50% 50%;background:#cea66e}
.bt2074:hover .cord{height:42px}
.bt2074:hover .pull{background:#ba4a62;transform:translateY(-10px)}
@keyframes cordSway{50%{transform:rotate(4deg)}}
@media (max-width:700px){.bt2074{left:7px;top:38%;transform:scale(.85);transform-origin:bottom left}}
@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
Theatres, performing arts and festivals.
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.