Aurora Admin v1.2.0: 79 components x 5 ends, doc site, contracts batch 1, playground, regression, deploy ready
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Aurora Admin · BackToTop(普通 H5)</title>
|
||||
<link rel="stylesheet" href="../.design_library/aurora-admin/colors_and_type.css" />
|
||||
<link rel="stylesheet" href="BackToTop.css" />
|
||||
<style>
|
||||
body { margin: 0; background: #F5F7FA; font-family: var(--font-family, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif); }
|
||||
.aa-demo-banner { padding: 24px; background: #fff; border-bottom: 1px solid #E8ECF1; }
|
||||
.aa-demo-banner h2 { margin: 0 0 8px; color: #1F2329; font-size: 18px; }
|
||||
.aa-demo-banner p { margin: 0; color: #8C8C8C; font-size: 13px; }
|
||||
.aa-demo-spacer { height: 2200px; padding: 24px; color: #8C8C8C; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="aa-demo-banner">
|
||||
<h2>向下滚动页面</h2>
|
||||
<p>滚动超过 400px 后右下角出现返回顶部按钮,环显示滚动进度,点击平滑回到顶部。</p>
|
||||
</div>
|
||||
<div class="aa-demo-spacer">这里是长内容占位区……</div>
|
||||
|
||||
<div class="aa-backtop" id="backtop" role="button" aria-label="返回顶部">
|
||||
<svg viewBox="0 0 44 44">
|
||||
<circle class="aa-backtop-ring-bg" cx="22" cy="22" r="20" fill="none" stroke-width="2" />
|
||||
<circle class="aa-backtop-ring-fg" id="ring" cx="22" cy="22" r="20" fill="none" stroke-width="2" />
|
||||
</svg>
|
||||
<span class="aa-backtop-arrow">↑</span>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var THRESHOLD = 400, R = 20, C = 2 * Math.PI * R;
|
||||
var el = document.getElementById('backtop');
|
||||
var ring = document.getElementById('ring');
|
||||
ring.style.strokeDasharray = C;
|
||||
ring.style.strokeDashoffset = C;
|
||||
|
||||
function onScroll() {
|
||||
var st = window.pageYOffset || document.documentElement.scrollTop;
|
||||
var max = document.documentElement.scrollHeight - window.innerHeight;
|
||||
var p = max > 0 ? st / max : 0;
|
||||
el.classList.toggle('is-visible', st > THRESHOLD);
|
||||
ring.style.strokeDashoffset = C * (1 - p);
|
||||
}
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
el.addEventListener('click', function () {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
onScroll();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user