TipsBlocks Web Technique Library

PRACTICAL WEB TIP

← Back to library

Ceramic Shard Return

A handcrafted ceramic shard that becomes a tactile TOP control.

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
<!-- Button only. Use CSS & JS files, deploy the matching PNG locally and replace remote image src. -->
<div class="tbtt-instance" data-tbtt-id="2132" data-tbtt-threshold="140" data-tbtt-source="shortcode"><button class="tbtt-button" type="button" aria-label="ページの先頭に戻る" aria-hidden="true" tabindex="-1" title="ページの先頭に戻る"><img class="tbtt-art" src="https://tipsblocks.com/wp-content/uploads/tipsblocks-btt-2121-2132/assets/art/TB-2132.png" alt="" draggable="false"></button></div>
CSS
/* TIPSBLOCKS Back to Top 2121-2132 — isolated styles, v1.1.0 */
.tbtt-instance,.tbtt-instance *{box-sizing:border-box}
.tbtt-instance{--tbtt-rise:12px;position:fixed!important;z-index:2147482000!important;opacity:0;visibility:hidden;pointer-events:none;transform:translate3d(0,var(--tbtt-rise),0);transition:opacity .26s ease,visibility .26s ease,transform .32s cubic-bezier(.2,.7,.2,1);contain:layout style;}
.tbtt-instance.tbtt-is-visible{opacity:1;visibility:visible;pointer-events:auto;transform:translate3d(0,0,0)}
.tbtt-instance .tbtt-button{display:flex;align-items:center;justify-content:center;position:relative;border:0!important;background:transparent!important;box-shadow:none!important;border-radius:0!important;padding:0!important;margin:0!important;min-width:0;min-height:0;width:100%;height:100%;max-width:none;max-height:none;color:inherit;cursor:pointer;line-height:1;appearance:none;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.tbtt-instance .tbtt-button::before,.tbtt-instance .tbtt-button::after{content:none!important}
.tbtt-instance .tbtt-art{display:block;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:contain!important;user-select:none;pointer-events:none;filter:drop-shadow(0 5px 5px rgb(0 0 0 / .17));transition:transform .3s cubic-bezier(.22,.74,.2,1),filter .3s ease}
.tbtt-instance .tbtt-button:focus-visible{outline:3px solid #d88a30!important;outline-offset:3px!important;border-radius:5px!important}
.tbtt-instance .tbtt-button:active .tbtt-art{transform:translateY(2px) scale(.97)!important}
.tbtt-instance .tbtt-label{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.tbtt-instance:is([data-tbtt-id="2121"],[data-tbtt-id="2124"],[data-tbtt-id="2125"],[data-tbtt-id="2127"],[data-tbtt-id="2132"]) .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:translateY(-6px)}
.tbtt-instance[data-tbtt-id="2123"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:translateY(-6px);filter:drop-shadow(0 1px 10px rgba(181,137,63,.38))}
.tbtt-instance[data-tbtt-id="2126"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:rotate(2deg);transform-origin:50% 15%}
.tbtt-instance[data-tbtt-id="2128"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:rotate(7deg);filter:drop-shadow(0 0 10px rgba(60,73,84,.46))}
.tbtt-instance[data-tbtt-id="2130"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:translateY(-5px)}
.tbtt-instance[data-tbtt-id="2131"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:rotate(-2deg) translateY(-4px)}
.tbtt-instance[data-tbtt-id="2127"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{animation:tbtt-bag-rise .55s ease-out}
@keyframes tbtt-bag-rise{0%,100%{transform:translateY(0)}55%{transform:translateY(-8px) rotate(-1.5deg)}}
/* Original art ratio is preserved throughout; height adjusts with width, never squashed. */
.tbtt-instance[data-tbtt-id="2121"]{width:min(113px,15.3vh);aspect-ratio:113 / 214;right:18px;bottom:70px}
.tbtt-instance[data-tbtt-id="2123"]{width:min(136px,17.3vh);aspect-ratio:136 / 170;right:26px;bottom:143px}
.tbtt-instance[data-tbtt-id="2124"]{width:min(78px,9.1vh);aspect-ratio:78 / 295;right:13px;bottom:55px}
.tbtt-instance[data-tbtt-id="2125"]{width:min(74px,10.5vh);aspect-ratio:74 / 188;left:clamp(190px,19vw,292px);top:75px;--tbtt-rise:-8px}
.tbtt-instance[data-tbtt-id="2126"]{width:min(85px,10.9vh);aspect-ratio:85 / 324;right:16px;bottom:0px}
.tbtt-instance[data-tbtt-id="2127"]{width:min(153px,16.7vh);aspect-ratio:153 / 287;right:29px;bottom:38px}
.tbtt-instance[data-tbtt-id="2128"]{width:min(146px,20vh);aspect-ratio:146 / 148;right:17px;bottom:49px}
.tbtt-instance[data-tbtt-id="2130"]{width:min(148px,20vh);aspect-ratio:148 / 152;right:20px;bottom:24px}
.tbtt-instance[data-tbtt-id="2131"]{width:min(135px,19vh);aspect-ratio:135 / 159;right:16px;bottom:16px}
.tbtt-instance[data-tbtt-id="2132"]{width:min(149px,19vh);aspect-ratio:149 / 160;right:27px;bottom:48px}
/* 2122: a proper live typography/line button (not a miniature graphic icon). */
.tbtt-instance[data-tbtt-id="2122"]{width:47px;height:247px;right:8px;top:33vh;transform:translateY(var(--tbtt-rise))}
.tbtt-instance[data-tbtt-id="2122"].tbtt-is-visible{transform:translateY(0)}
.tbtt-instance[data-tbtt-id="2122"] .tbtt-button{flex-direction:column;gap:0;color:#a33a27!important;background:rgba(255,252,247,.86)!important;}
.tbtt-type-top{font:600 11px/1.3 Georgia,"Times New Roman",serif;letter-spacing:.21em;margin-left:.22em}
.tbtt-type-line{display:block;width:1.5px;height:104px;margin:13px 0 18px;background:currentColor;position:relative;transition:height .25s}
.tbtt-type-line:before{content:"";position:absolute;top:0;left:-3.5px;width:8px;height:8px;border-top:1.5px solid currentColor;border-left:1.5px solid currentColor;transform:rotate(45deg)}
.tbtt-type-return{font:500 13px/1.4 Georgia,"Times New Roman",serif;writing-mode:vertical-rl;letter-spacing:.21em;transition:transform .25s}
.tbtt-instance[data-tbtt-id="2122"] .tbtt-button:is(:hover,:focus-visible) .tbtt-type-line{height:118px}
.tbtt-instance[data-tbtt-id="2122"] .tbtt-button:is(:hover,:focus-visible) .tbtt-type-return{transform:translateY(-4px)}
/* 2129: rail and hit target share a coordinate system; the rail is NEVER distorted. */
.tbtt-instance[data-tbtt-id="2129"]{width:min(137px,calc(20.92dvh - 20.92px));aspect-ratio:137 / 655;right:9px;top:clamp(52px,12vh,125px);--tbtt-rise:0px;pointer-events:none}
.tbtt-instance[data-tbtt-id="2129"] .tbtt-mobile-art{display:none}
.tbtt-rail-art{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 4px 4px rgba(25,29,28,.17));pointer-events:none}
.tbtt-instance[data-tbtt-id="2129"] .tbtt-button{position:absolute;left:14.6%;top:7.18%;width:64.96%;height:16.80%;pointer-events:auto}
.tbtt-instance[data-tbtt-id="2129"] .tbtt-button .tbtt-art{filter:none}
.tbtt-instance[data-tbtt-id="2129"] .tbtt-button:is(:hover,:focus-visible) .tbtt-art{transform:scale(1.04);filter:drop-shadow(0 0 4px rgba(242,109,0,.47))}
@media(max-width:767px){
 .tbtt-instance{--tbtt-rise:9px!important}
 .tbtt-instance:not([data-tbtt-id="2129"]){left:auto!important;top:auto!important;right:calc(12px + env(safe-area-inset-right,0px))!important;bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}
 .tbtt-instance[data-tbtt-id="2121"]{width:64px}
 .tbtt-instance[data-tbtt-id="2122"]{width:52px;height:182px;box-shadow:0 2px 12px rgb(0 0 0 / .06)}
 .tbtt-instance[data-tbtt-id="2122"] .tbtt-type-line{height:67px;margin:10px 0 14px}
 .tbtt-instance[data-tbtt-id="2122"] .tbtt-button:is(:hover,:focus-visible) .tbtt-type-line{height:77px}
 .tbtt-instance[data-tbtt-id="2123"]{width:83px}
 .tbtt-instance[data-tbtt-id="2124"]{width:49px}
 .tbtt-instance[data-tbtt-id="2125"]{width:53px}
 .tbtt-instance[data-tbtt-id="2126"]{width:47px}
 .tbtt-instance[data-tbtt-id="2127"]{width:76px}
 .tbtt-instance[data-tbtt-id="2128"]{width:78px}
 .tbtt-instance[data-tbtt-id="2130"]{width:82px}
 .tbtt-instance[data-tbtt-id="2131"]{width:82px}
 .tbtt-instance[data-tbtt-id="2132"]{width:85px}
 .tbtt-instance[data-tbtt-id="2129"]{top:auto!important;bottom:calc(14px + env(safe-area-inset-bottom,0px));right:calc(12px + env(safe-area-inset-right,0px));width:73px;aspect-ratio:1 / 1;pointer-events:auto}
 .tbtt-instance[data-tbtt-id="2129"] .tbtt-rail-art{display:none}
 .tbtt-instance[data-tbtt-id="2129"] .tbtt-button .tbtt-art{display:none}
 .tbtt-instance[data-tbtt-id="2129"] .tbtt-button .tbtt-mobile-art{display:block}
 .tbtt-instance[data-tbtt-id="2129"] .tbtt-button{position:absolute;inset:0;width:100%;height:100%}
}
@media(max-width:380px){.tbtt-instance[data-tbtt-id="2123"]{width:74px}.tbtt-instance[data-tbtt-id="2127"]{width:66px}.tbtt-instance[data-tbtt-id="2130"]{width:73px}}
@media(max-height:560px) and (min-width:768px){.tbtt-instance[data-tbtt-id="2122"]{top:13vh;height:205px}.tbtt-instance[data-tbtt-id="2129"]{top:36px;width:min(93px,calc(20.92dvh - 10.46px))}}
@media(prefers-reduced-motion:reduce){.tbtt-instance,.tbtt-instance *{transition:none!important;animation:none!important;scroll-behavior:auto!important}}
JavaScript
/* TIPSBLOCKS Back to Top pack; standalone, no framework dependency */
(() => {
  'use strict';
  const boot = () => {
  const all = Array.from(document.querySelectorAll('.tbtt-instance'));
  if (!all.length) return;
  const shortcut = all.filter(el => el.dataset.tbttSource === 'shortcode');
  if (shortcut.length) {
    all.filter(el => el.dataset.tbttSource === 'global').forEach(el => el.remove());
  }
  const preview = new URLSearchParams(window.location.search).get('tb_preview');
  const previewMode = ['card','large','context'].includes(preview) ? preview : '';
  if (previewMode) document.documentElement.classList.add('tbtt-preview','tbtt-preview-'+previewMode);
  const widgets = Array.from(document.querySelectorAll('.tbtt-instance'));
  const motion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)');
  let queued = false;
  const update = () => {
    queued = false;
    const y = Math.max(0, window.scrollY || window.pageYOffset || 0);
    widgets.forEach(widget => {
      const threshold = Number(widget.dataset.tbttThreshold || 140);
      const showing = Boolean(previewMode) || y >= threshold;
      widget.classList.toggle('tbtt-is-visible', showing);
      const button = widget.querySelector('.tbtt-button');
      if (button) {
        button.setAttribute('aria-hidden', showing ? 'false' : 'true');
        button.tabIndex = showing ? 0 : -1;
      }
    });
  };
  const requestUpdate = () => {
    if (!queued) {
      queued = true;
      window.requestAnimationFrame(update);
    }
  };
  widgets.forEach(widget => {
    const button = widget.querySelector('.tbtt-button');
    if (!button) return;
    button.addEventListener('click', () => {
      window.scrollTo({top:0, left:0, behavior: motion && motion.matches ? 'instant' : 'smooth'});
    });
  });
  window.addEventListener('scroll', requestUpdate, {passive:true});
  window.addEventListener('pageshow', requestUpdate);
  window.addEventListener('resize', requestUpdate, {passive:true});
  update();
  };
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', boot, {once:true});
  } else {
    boot();
  }
})();

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

Pottery workshops and ceramics studios.

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.