当前位置: 首页 > news >正文

github搭建个人主页

以前在github搭建过一个个人主页。链接:

现在修改下,改为一个工具页面,左侧是菜单,点击菜单在右侧显示页面。index.html改为如下:

<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Xuange2026 的个人主页</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; height: 100vh; display: flex; background: #f5f5f5; } /* 左侧菜单 */ .sidebar { width: 200px; background: #2c3e50; color: white; display: flex; flex-direction: column; overflow-y: auto; box-shadow: 2px 0 8px rgba(0,0,0,0.1); } .sidebar h2 { padding: 20px 16px 10px; font-size: 18px; font-weight: 500; border-bottom: 1px solid rgba(255,255,255,0.2); margin-bottom: 10px; text-align: center; } .menu-list { list-style: none; flex: 1; padding: 0 8px; } .menu-item { padding: 12px 16px; margin: 4px 0; border-radius: 6px; cursor: pointer; transition: background 0.2s; color: #ecf0f1; font-size: 15px; word-break: break-all; } .menu-item:hover { background: rgba(255,255,255,0.15); } .menu-item.active { background: #3498db; color: white; font-weight: 500; } /* 右侧内容区 */ .content { flex: 1; position: relative; background: white; } .iframe-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; display: none; } .iframe-container.active { display: block; } .placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #95a5a6; font-size: 20px; } .placeholder.hidden { display: none; } /* 秘密小圆点 */ .secret-trigger{ position:fixed; bottom:6px; right:6px; width:14px; height:14px; background:#eeeeee; border-radius:50%; z-index:9998; cursor:pointer; } .secret-trigger:hover{ background:#cccccc; } /* 全屏遮罩层,用来加载独立love.html */ .love-layer{ position:fixed; inset:0; z-index:9999; display:none; } .love-layer.show{ display:block; } .love-layer iframe{ width:100%; height:100%; border:none; } .love-close{ position:fixed; top:12px; right:12px; z-index:10001; background:rgba(255,255,255,0.35); border:1px solid #d44e6c; color:#d44e6c; padding:4px 10px; border-radius:8px; cursor:pointer; font-size:13px; } .love-close:hover{ background:rgba(255,255,255,0.7); } </style> </head> <body> <div class="secret-trigger" id="secretBtn" title="秘密入口"></div> <div class="sidebar"> <h2>常用工具</h2> <ul class="menu-list" id="menuList"></ul> </div> <div class="content" id="contentArea"> <div class="placeholder" id="placeholder">👈 点击左侧菜单打开页面</div> </div> <!-- 全屏层:iframe加载独立love.html --> <div class="love-layer" id="loveLayer"> <button class="love-close" id="closeLove">← 返回工具页</button> <iframe src="love.html"></iframe> </div> <script> (function() { const menuItems = [ { name: 'JSON格式化', url: 'https://www.sojson.com/' }, { name: '百度', url: 'https://www.baidu.com/' }, { name: '必应', url: 'https://www.bing.com/' }, { name: '时间戳转换', url: 'https://tool.lu/timestamp/' }, {name: '博客', url: 'https://blog.csdn.net/u012116089?type=blog'} ]; const menuList = document.getElementById('menuList'); const contentArea = document.getElementById('contentArea'); const placeholder = document.getElementById('placeholder'); const secretBtn = document.getElementById("secretBtn"); const loveLayer = document.getElementById("loveLayer"); const closeLove = document.getElementById("closeLove"); const iframeCache = {}; let currentActiveIndex = -1; //打开全屏层(只是显示,不跳转页面,主页面状态全部保留) function openLove(){ loveLayer.classList.add("show"); } function closeLoveFunc(){ loveLayer.classList.remove("show"); } secretBtn.addEventListener("click", openLove); closeLove.addEventListener("click", closeLoveFunc); function renderMenu() { menuItems.forEach((item, index) => { const li = document.createElement('li'); li.className = 'menu-item'; li.textContent = item.name; li.dataset.index = index; li.addEventListener('click', () => switchToMenu(index)); menuList.appendChild(li); }); } function switchToMenu(index) { if (currentActiveIndex === index) return; const allItems = menuList.querySelectorAll('.menu-item'); allItems.forEach(item => item.classList.remove('active')); allItems[index].classList.add('active'); placeholder.classList.add('hidden'); if (currentActiveIndex !== -1) { const prevIframe = iframeCache[currentActiveIndex]; if (prevIframe) prevIframe.classList.remove('active'); } if (!iframeCache[index]) { createIframe(index); } iframeCache[index].classList.add('active'); currentActiveIndex = index; } function createIframe(index) { const iframe = document.createElement('iframe'); iframe.className = 'iframe-container'; iframe.src = menuItems[index].url; iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts allow-popups allow-forms'); contentArea.appendChild(iframe); iframeCache[index] = iframe; } renderMenu(); })(); </script> </body> </html>

还有一个love.html, 代码略。

然后上传到github的个人主页。步骤略。

网页打开效果:

ok.

http://www.jsqmd.com/news/1404589/

相关文章:

  • 网络安全必备:Linux命令行操作手册与实用技巧
  • 亦唐科技:引领国产贴片机创新,推动智能制造升级
  • 基于大语言模型的申论作文AI批改实战:从原理到Python实现
  • 2026暑假
  • NAATI成绩单翻译:材料清单与机构资质甄别全攻略
  • IntelliJ IDEA插件工具箱:提升Java开发效率的必备神器
  • VSCode配置JavaWeb开发环境:从环境搭建到项目部署全指南
  • LangGraph实战:构建具备长期记忆与动态决策的智能体工作流
  • 对比5款降AI工具:哪种方案更适合知网、多平台和高AI率论文? - 我要发一区
  • 3个真实场景玩转N_m3u8DL-RE:在线视频秒变本地文件的流媒体下载指南
  • WEEX:长鑫科技上市大涨,宇树科技合约同步走高,传统资产交易迎来新路径
  • 三分钟永久修改Word默认样式:告别重复格式设置,提升文档效率
  • 终极指南:CM211-1(MC022)盒子 Armbian 适配深度解析与决策式排障手册
  • 2026 年当下,南京比较好的数据中心干式变压器直销厂家哪家强,数据中心供电核心,竟藏着你从未留意的安全隐患? - 企业推荐管【认证】
  • NewSQL(TiDB) vs 传统分库分表中间件(ShardingSphere):Python大数据分析视角的全方位对比
  • Postman Mock Server 实战:从零搭建模拟API服务,提升开发与测试效率
  • 西门子S7-200 SMART V2.8升级:PTO运动控制与OPC UA通信深度解析
  • VS Code高效文本编辑:从基础操作到高级技巧,提升开发效率
  • 湘潭新房装修除甲醛怎么选?实地调研对比,教你筛选靠谱本地除甲醛公司 - 专注室内空气检测治理
  • 2026游戏安全防御:DDoS防护与API安全实战
  • 程序员跨界实践:从摇滚乐与烹饪中汲取技术创造力
  • Spring Cloud 分布式底座:万象生鲜系统生鲜配送业务弹性扩容技术解析
  • OpenClaw与Deepgram集成实战:构建自动化语音笔记系统
  • 2026年大型数控大圆机制造商综合解析:针织提花效率与精度的平衡之道 - 卓企推荐
  • pgroonga 配合生成列 + B-tree zhparser 选那个版本的 pgsql 比较好 安装扩展比较容易 - 孙龙
  • 如何挑选优质电动执行器?揭秘行业内幕,让你选对不踩雷
  • AI工作流引擎:从模型能力到业务流程重塑的工程实践
  • 解决IntelliJ IDEA中JVM废弃参数警告的完整指南
  • 实测5类降AI工具:哪款让不同平台的论文AI率达到更稳结果? - 我要发一区
  • 论文AI率居高不下?从困惑度、突发度和语言指纹拆解有效降AI思路! - 我要发一区