返回列表 发帖
查看: 29|回复: 1

免费分享几个我原创的首页侧边栏模块

46

主题

152

回帖

205

积分

炉火纯青

贡献
0 点
金币
1 个
发表于 3 小时前 | 查看全部 |阅读模式

分享下我自己折腾的自定义模块代码供大家下载,可能某些主题不支持,具体大家自行测试



侧边栏发帖按钮代码:
  1. <div style="margin: 20px 0;">
  2.     <style>
  3.         @import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');
  4.     </style>
  5.     <a href="forum.php?mod=misc&action=nav"
  6.        onclick="showWindow('nav', this.href, 'get', 0); return false;"
  7.        style="display: block; width: 100%; background-color: #009a61; color: white; padding: 12px 0; border-radius: 8px; text-align: center; text-decoration: none; font-size: 16px; font-weight: 500; transition: background-color 0.2s ease;"
  8.        onmouseover="this.style.backgroundColor='#007a4d'"
  9.        onmouseout="this.style.backgroundColor='#009a61'">
  10.         <i class="fas fa-edit" style="margin-right: 6px;"></i> 我要发帖
  11.     </a>
  12. </div>
复制代码


首页公告框重新美化
  1. <style>
  2.         #notices {
  3.             max-width: 800px;
  4.             margin: 0 auto;
  5.             padding: 0;
  6.         }

  7.         .alert-notice {
  8.             background: #f8fdf8;
  9.             border: 1px solid #e5f3e5;
  10.             border-radius: 6px;
  11.             padding: 16px;
  12.             margin: 12px 0;
  13.             border-left: 3px solid #22c55e;
  14.         }

  15.         .alert-notice h2 {
  16.             color: #14532d;
  17.             font-weight: 600;
  18.             font-size: 18px;
  19.             margin: 0 0 12px 0;
  20.         }

  21.         .alert-notice p {
  22.             color: #166534;
  23.             font-size: 14px;
  24.             line-height: 1.5;
  25.             margin: 8px 0;
  26.         }

  27.         .alert-notice a {
  28.             color: #14532d;
  29.             text-decoration: none;
  30.             font-weight: 500;
  31.         }

  32.         .alert-notice a:hover {
  33.             color: #0f3b21;
  34.             text-decoration: underline;
  35.         }

  36.         @media (max-width: 768px) {
  37.             .alert-notice {
  38.                 padding: 14px;
  39.                 margin: 10px;
  40.             }
  41.         }
  42.     </style>
  43. </head>

  44. <div id="notices" class="">
  45.     <div class="alert-notice alert-warning" role="alert">
  46.         <h2>欢迎加入 Blog do 论坛!</h2>
  47.         <p>Blog do 论坛是博客建站爱好者的交流平台,我们致力于为大家提供一个开放的交流环境。</p>
  48.         
  49.         <p>Blog do论坛官网:<a class="report xs-12" href="https://nav.blog.do/" target="_blank">https://www.blog.do/</a></p>
  50.         
  51.         <p>Blog do网址导航:<a class="report xs-12" href="https://nav.blog.do/" target="_blank">https://nav.blog.do/</a></p>
  52.         
  53.         <p>站长邮箱:admin@blog.do</p>
  54.     </div>
  55. </div>
复制代码


添加侧边栏友情链接展示框

  1. <title>友情链接 - 美化版</title>
  2.     <style>
  3. /* 友情链接容器 */
  4.         .x.cl {
  5.             background: #ffffff;
  6.             border-radius: 12px;
  7.             box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  8.             overflow: hidden;
  9.             margin-bottom: 20px;
  10.             border: 1px solid rgba(0, 0, 0, 0.05);
  11.         }

  12.         /* 标题样式 */
  13.         .friendship-title {
  14.             background: #f8f9fa;
  15.             color: #333;
  16.             padding: 12px 16px;
  17.             margin: 0;
  18.             font-size: 14px;
  19.             font-weight: 500;
  20.             display: flex;
  21.             align-items: center;
  22.             position: relative;
  23.             border-bottom: 1px solid #e9ecef;
  24.         }

  25.         .friendship-title::before {
  26.             content: "🔗";
  27.             margin-right: 6px;
  28.             font-size: 14px;
  29.         }

  30.         /* 链接列表 */
  31.         .cl.mbm {
  32.             list-style: none;
  33.             margin: 0;
  34.             padding: 10px;
  35.             display: flex;
  36.             flex-wrap: wrap;
  37.             gap: 6px;
  38.         }

  39.         .cl.mbm li {
  40.             position: relative;
  41.             transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  42.             flex: 0 0 calc(50% - 3px);
  43.         }

  44.         .cl.mbm li a {
  45.             display: block;
  46.             padding: 8px 12px;
  47.             color: #333;
  48.             text-decoration: none;
  49.             font-size: 12px;
  50.             font-weight: 400;
  51.             position: relative;
  52.             transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  53.             background: #f8f9fa;
  54.             border-radius: 6px;
  55.             text-align: center;
  56.             line-height: 1.3;
  57.             white-space: nowrap;
  58.             overflow: hidden;
  59.             text-overflow: ellipsis;
  60.         }

  61.         .cl.mbm li a::before {
  62.             content: "";
  63.             position: absolute;
  64.             left: 0;
  65.             top: 0;
  66.             bottom: 0;
  67.             width: 100%;
  68.             background: rgba(0, 153, 101, 0.1);
  69.             opacity: 0;
  70.             border-radius: 6px;
  71.             transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  72.             z-index: -1;
  73.         }

  74.         /* 悬停效果 */
  75.         .cl.mbm li:hover {
  76.             transform: translateY(-2px);
  77.         }

  78.         .cl.mbm li:hover a {
  79.             color: #009965;
  80.         }

  81.         .cl.mbm li:hover a::before {
  82.             opacity: 1;
  83.         }

  84.         /* 响应式设计 */
  85.         @media (max-width: 768px) {
  86.             .sidebar-demo {
  87.                 max-width: 100%;
  88.                 margin: 0;
  89.             }
  90.             
  91.             .friendship-title {
  92.                 padding: 10px 12px;
  93.                 font-size: 13px;
  94.             }
  95.             
  96.             .cl.mbm {
  97.                 padding: 8px;
  98.             }
  99.             
  100.             .cl.mbm li a {
  101.                 padding: 6px 8px;
  102.                 font-size: 11px;
  103.             }
  104.         }

  105.         /* 加载动画 */
  106.         .x.cl {
  107.             animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  108.         }

  109.         @keyframes slideInUp {
  110.             from {
  111.                 opacity: 0;
  112.                 transform: translateY(20px);
  113.             }
  114.             to {
  115.                 opacity: 1;
  116.                 transform: translateY(0);
  117.             }
  118.         }

  119.         /* 深色模式支持 */
  120.         @media (prefers-color-scheme: dark) {
  121.             body {
  122.                 background: #1a1a1a;
  123.             }
  124.             
  125.             .x.cl {
  126.                 background: #2d2d2d;
  127.                 border-color: rgba(255, 255, 255, 0.1);
  128.                 box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  129.             }
  130.             
  131.             .cl.mbm li a {
  132.                 color: #e0e0e0;
  133.             }
  134.             
  135.             .cl.mbm li:hover a {
  136.                 background: linear-gradient(90deg, rgba(0, 153, 101, 0.15), rgba(0, 153, 101, 0.08));
  137.                 color: #009965;
  138.             }
  139.             
  140.             .cl.mbm li:not(:last-child)::after {
  141.                 background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  142.             }
  143.         }
  144.     </style>
  145. </head>
  146. <body>
  147.     <div class="sidebar-demo">
  148.         <!-- 友情链接模块 - 使用Discuz动态代码 -->
  149.         <div class="x cl">
  150.             <h3 class="friendship-title">友情链接</h3>
  151.             <ul class="cl mbm">
  152.                 [loop]
  153.                 <li><a href="{url}" {target}>{title}</a></li>
  154.                 [/loop]
  155.             </ul>
  156.         </div>
  157.     </div>
复制代码



回复

使用道具 举报

117

主题

975

回帖

1304

积分

已臻大成

贡献
18 点
金币
17 个
QQ
发表于 2 小时前 | 查看全部
图呢,贴个图比较好
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 关注公众号
  • 有偿服务微信
  • 有偿服务QQ

手机版|小黑屋|Discuz! 官方交流社区 ( 皖ICP备16010102号 |皖公网安备34010302002376号 )|网站地图|star

GMT+8, 2025-8-3 23:43 , Processed in 0.067311 second(s), 26 queries .

Powered by Discuz! W1.0 Licensed

Copyright © 2001-2025 Discuz! Team.

关灯 在本版发帖
有偿服务QQ
有偿服务微信
返回顶部
快速回复 返回顶部 返回列表