文件
navi/static/js/common.js
T
wangchuanli bff5252ff5 feat: 初始化导航网站项目
添加 Flask 导航站应用,包含 Docker 部署配置、SQLite 数据库、静态资源及 CI/CD 流水线。
2026-08-21 16:36:08 +08:00

28 行
805 B
JavaScript

// common.js
// menu
$(document).ready(function () {
// fix menu when passed
$('.masthead').visibility({
once: false,
onBottomPassed: function () {
$('.fixed.menu').transition('fade in');
},
onBottomPassedReverse: function () {
$('.fixed.menu').transition('fade out');
}
});
// create sidebar and attach to menu open
$('.ui.sidebar').sidebar('attach events', '.toc.item');
// avatar
let avatarId = $('#username').attr("data-user")
fetch('https://api.multiavatar.com/'
+JSON.stringify(avatarId))
.then(res => res.text())
.then(svg => $('#user-avatar').html(svg))
});
// masthead background
$('.ui.inverted.masthead.segment').addClass(`bg${Math.ceil(Math.random() * 14)}`).removeClass('zoomed');