久伴的个人软件,代码,教程仓库
首页
笔记
  • 运维类
  • 代码类
  • 软件
  • 视频录制
  • 文本编辑
  • AI产品
  • SSH客户端
  • 硬件检测
  • U盘引导
  • 系统工具
  • Emlog
  • Emlog教程
  • 关于我和我的博客
    登录
    侧边栏壁纸
    博主头像
    久伴

    • 累计撰写 20 篇文章
    • 累计收到 4 条评论
    • 首页
    • 栏目
      • 首页
      • 笔记
        • 运维类
        • 代码类
      • 软件
        • 视频录制
        • 文本编辑
        • AI产品
        • SSH客户端
        • 硬件检测
        • U盘引导
        • 系统工具
      • Emlog
        • Emlog教程
      • 关于我和我的博客
    Emlog教程
    • emlog侧边栏时间倒计时html代码 2025-3-14
      emlog侧边栏时间倒计时html代码 效果截图 HTML代码 <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <title>时间进度侧边栏</title> <style> :root { --sidebar-bg: #f5f7fa; --text-primary: #2c3e50; --progress-bg: #e0e0e0; --progress-fill: #3498db; } .j-date { width: 280px; padding: 20px; background: var(--sidebar-bg); border-radius: 12px; box-shadow: 0 2px 15px rgba(0,0,0,0.1); font-family: 'Segoe UI', system-ui; } .progress-item { margin: 18px 0; } .progress-title { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; } .progress-text { font-size: 0.9em; color: #666; margin-bottom: 8px; } .progress-bar { height: 8px; background: var(--progress-bg); border-radius: 4px; overflow: hidden; } .progress-fill { height: 100%; background: var(--progress-fill); border-radius: 4px; transition: width 0.5s ease; } .progress-percent { float: right; font-size: 0.85em; color: #7f8c8d; } /* 新增底部时间样式 */ .time-footer { margin-top: 25px; padding-top: 15px; border-top: 1px solid #eee; text-align: center; font-size: 0.95em; } #current-time { color: var(--text-primary); font-weight: 500; } #current-time span { color: #e74c3c; letter-spacing: 0.5px; } </style> </head> <body> <!-- 原有进度条模块 --> <div class="progress-item"> <div class="progress-title">本周进度</div> <div class="progress-text" id="week-text"></div> <div class="progress-bar"> <div class="progress-fill" id="week-progress"></div> </div> <span class="progress-percent" id="week-percent"></span> </div> <div class="progress-item"> <div class="progress-title">本月进度</div> <div class="progress-text" id="month-text"></div> <div class="progress-bar"> <div class="progress-fill" id="month-progress"></div> </div> <span class="progress-percent" id="month-percent"></span> </div> <div class="progress-item"> <div class="progress-title">本年进度</div> <div class="progress-text" id="year-text"></div> <div class="progress-bar"> <div class="progress-fill" id="year-progress"></div> </div> <span class="progress-percent" id="year-percent"></span> </div> <div class="progress-item"> <div class="progress-title">今日进度</div> <div class="progress-text" id="day-text"></div> <div class="progress-bar"> <div class="progress-fill" id="day-progress"></div> </div> <span class="progress-percent" id="day-percent"></span> </div> <!-- 新增底部时间模块 --> <div class="time-footer"> <div id="current-time"></div> </div> <script> // 时间格式化函数 function formatTime(date) { return date.toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' }).replace(/\//g, '月').replace('日', '号').replace(' ', ' '); } // 修正后的周进度计算 function calculateWeekProgress(now) { const tempDate = new Date(now); const day = tempDate.getDay(); const diffToMonday = day === 0 ? 6 : day - 1; const monday = new Date(tempDate); monday.setDate(tempDate.getDate() - diffToMonday); monday.setHours(0, 0, 0, 0); const nextMonday = new Date(monday); nextMonday.setDate(monday.getDate() + 7); return (now - monday) / (nextMonday - monday); } function updateProgress() { const now = new Date(); // 更新时间显示 document.getElementById('current-time').innerHTML = `当前时间:<span>${formatTime(now)}</span>`; // 进度计算 const weekProgress = calculateWeekProgress(now); const monthDays = new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate(); const monthProgress = (now.getDate() - 1 + now.getHours() / 24) / monthDays; const yearStart = new Date(now.getFullYear(), 0, 1); const yearEnd = new Date(now.getFullYear() + 1, 0, 1); const yearProgress = (now - yearStart) / (yearEnd - yearStart); const dayProgress = (now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()) / 86400; // 更新进度条 updateElement('week', weekProgress, Math.floor(weekProgress * 7), 7 - Math.floor(weekProgress * 7)); updateElement('month', monthProgress, now.getDate(), monthDays - now.getDate()); updateElement('year', yearProgress, Math.ceil(yearProgress * 365), 365 - Math.ceil(yearProgress * 365)); updateElement('day', dayProgress, now.getHours(), 24 - now.getHours()); } function updateElement(type, progress, passed, remaining) { document.getElementById(`${type}-text`).textContent = `已过去 ${passed} ${type === 'day' ? '小时' : '天'},剩余 ${remaining} ${type === 'day' ? '小时' : '天'}`; document.getElementById(`${type}-progress`).style.width = `${Math.min(100, (progress * 100).toFixed(2))}%`; document.getElementById(`${type}-percent`).textContent = `${(progress * 100).toFixed(1)}%`; } // 每秒更新 setInterval(updateProgress, 1000); updateProgress(); </script> </body> </html>
      • 2025年-3月-14日
      • 1668 阅读
      • 0 评论
      Emlog教程
    • Emlog修复Simply简洁博客主题文章页侧边栏微语头像加载失败问题 2025-3-10
      Emlog修复Simply简洁博客主题文章页侧边栏微语头像加载失败问题 修复教程 1 主题需要修改的文件 你的网站目录/content/templates/simply/module.php 2 找到注释 侧边栏:最新微语 如下图示 将 <img src="<?= $avatar ?>" alt="<?= $author ?>"> 修改为 <img src="<?= BLOG_URL,$avatar ?>" alt="<?= $author ?>"> 保存,前往你网站的文章页面刷新,查看微语模块,头像就显示出来啦~
      • 2025年-3月-10日
      • 1820 阅读
      • 0 评论
      Emlog教程
    博主栏壁纸
    博主头像 久伴

    20 文章数
    4 评论量
    人生倒计时
    微语
    • 久伴
      5 个月前
      开始认真捣鼓网站啦!...
    • 久伴
      12 个月前
      早上喝一杯MStand 美式+一根可颂还不错...
    • 久伴
      1 年前
      今天中午吃炒饭...
    • 久伴
      1 年前
      今天中午吃轻食...
    • 久伴
      1 年前
      还是更喜欢田园生活一些...
    • 久伴
      1 年前
      厌倦上班,无奈不上班没钱花...
    • 久伴
      1 年前
      今天冲话费花费200大洋,新疼几秒~~...
    最新评论
    • 久伴
      久伴
      6 天前
    • 久伴
      久伴
      1 个月前
      333
    • Josephlef
      Josephlef
      2 个月前
      非常有用的 旅游信息网站, 不要停下 保...
    • SteveDox
      SteveDox
      2 个月前
      我一直梦想, 能像你们一样多旅行。继续分...
    热门文章
    1. 1 解决docker无法拉取镜像源,报错Unable to find image ‘mysql:latest‘ locally问题
      解决docker无法拉取镜像源,报错Unable to find image ‘mysql:latest‘ locally问题
    2. 2 xshell与xftp社区版下载免费使用无需破解
      xshell与xftp社区版下载免费使用无需破解
    3. 3 XYplorer v26.90.0300绿色版
      XYplorer v26.90.0300绿色版
    4. 4 OBSRec录屏大师 一键无损录制,多种工具辅助,实时预览效果
      OBSRec录屏大师 一键无损录制,多种工具辅助,实时预览效果
    5. 5 Emlog修复Simply简洁博客主题文章页侧边栏微语头像加载失败问题
      Emlog修复Simply简洁博客主题文章页侧边栏微语头像加载失败问题
    • 久伴博客
    载入天数...载入时分秒...
    Copyright © 2018 - 2025 JiuBan. All Rights Reserved. 鄂ICP备2024032463号-2