Magnifying Preview Rail
Navigation @bhaskar Stars:0 Views:1
<div class="pr"><div class="rl"></div><div class="pc"><small></small><b></b></div></div>
<style>
.pr{position:relative;width:100%;height:100%;min-height:380px;display:flex;align-items:center;justify-content:center;font-family:system-ui,-apple-system,sans-serif;color:#eee;}.rl{position:relative;width:60px;height:280px;cursor:pointer}.tk{position:absolute;left:0;height:2px;border-radius:2px;background:#555;transition:width .12s,background .2s}.tk.on{background:#0a84ff}.pc{position:absolute;left:50%;margin-left:10px;top:50%;width:150px;background:#1b1b1b;border:1px solid #2a2a2a;border-radius:12px;padding:10px 12px;opacity:0;pointer-events:none;transition:opacity .2s,transform .3s cubic-bezier(.3,1.3,.5,1)}.pc.on{opacity:1}.pc small{display:block;font-size:10px;color:#777}.pc b{font-size:13px}
</style>
<script>
(function(){var R=document.querySelector(".pr"),rl=R.querySelector(".rl"),pc=R.querySelector(".pc"),N=["Intro","Install","Usage","Props","Theming","Motion","Accessibility","Examples","Recipes","Forms","Tables","Charts","FAQ","Changelog"],P=20,sel=2,T=N.map(function(n,i){var t=document.createElement("i");t.className="tk";t.style.top=i*P+6+"px";t.style.width="10px";rl.appendChild(t);return t});function mk(){T.forEach(function(t,i){t.classList.toggle("on",i===sel)})}rl.onpointermove=function(e){var r=rl.getBoundingClientRect(),y=e.clientY-r.top,h=Math.max(0,Math.min(N.length-1,Math.round((y-6)/P)));T.forEach(function(t,i){var d=Math.abs(i*P+6-y)/P;t.style.width=(10+26*Math.exp(-d*d/2.2))+"px"});pc.querySelector("small").textContent=(h+1)+" / "+N.length;pc.querySelector("b").textContent=N[h];pc.style.transform="translateY("+(h*P+6-140+0)+"px) translateY(-50%) translateY(140px)";pc.style.top="calc(50% - 140px)";pc.style.transform="translateY("+(h*P+6)+"px) translateY(-50%)";pc.classList.add("on");rl.setAttribute("data-h",h)};rl.onpointerleave=function(){T.forEach(function(t){t.style.width="10px"});pc.classList.remove("on")};rl.onclick=function(){sel=+rl.getAttribute("data-h")||0;mk()};mk()})();
</script>