TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Yuzu Bottle — Product Back to Top

A fictional yuzu soda bottle acts as the page-top control, with a gentle bubble animation.

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-2061 / Yuzu Bottle / 商品の一部 | paste before the closing body tag (inside the footer for TB-2069) -->
<button aria-label="ページの先頭へ戻る" class="btt bottle tb-btt-2061" type="button"><i class="bubbles"></i><img alt="" src="https://tipsblocks.com/wp-content/uploads/tipsblocks-btt-2061-2072/assets/yuzu.webp"><span class="bottle-note">back to beginning</span></img></button>
CSS
/* 2061 / production button rules only */
.tb-btt-2061{box-sizing:border-box;font:inherit;cursor:pointer}.tb-btt-2061 :is(span,i,em,b,small,img){box-sizing:border-box}
.btt.tb-btt-2061{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-2061:focus-visible{outline:3px solid #f0af43;outline-offset:5px}.tb-btt-2061 .bottle{right:22px;bottom:22px;width:98px;min-height:145px;background:transparent}.tb-btt-2061 .bottle img{width:90px;display:block;margin:auto;filter:drop-shadow(0 10px 8px #57482d34);transition:transform .5s cubic-bezier(.2,.7,.2,1)}.tb-btt-2061 .bottle:hover img{transform:translateY(-13px) rotate(-5deg)}.tb-btt-2061 .bottle-note{font:700 9px/1.2 Arial,sans-serif;letter-spacing:.045em;display:block;background:#fff8dfed;color:#4e593e;border-radius:12px;padding:5px 4px;box-shadow:0 3px 12px #4e593e28}.tb-btt-2061 .bubbles{position:absolute;top:-11px;left:25px;width:42px;height:42px;background:radial-gradient(circle at 20% 60%,#f7de7b 0 3px,transparent 4px),radial-gradient(circle at 50% 20%,#f7de7b 0 4px,transparent 5px),radial-gradient(circle at 80% 65%,#f7de7b 0 3px,transparent 4px);animation:tb-btt-2061-rise 2.8s ease-in-out infinite}@media  (max-width:600px){.tb-btt-2061 .bottle{right:12px;bottom:16px;width:85px}.tb-btt-2061 .bottle img{width:76px}}
@keyframes tb-btt-2061-rise{50%{transform:translateY(-16px);opacity:.35}}
@media(prefers-reduced-motion:reduce){.tb-btt-2061,.tb-btt-2061 *{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

Brand sites and beverage product pages.

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.