0

【新生指南-003】优化你的项目-Sun-Panel简单美化教程(喂奶级)

发表于:6 天前 Docker 262
本帖最后由 madrays 于 2024-10-13 13:44 编辑

还是玩玩Sun-Panel,最近发现了不少大佬们分享的美化教程,很有意思研究了一下,主要有渐变背景、网页播放器、鼠标悬停动画这几个我觉得比较简约好玩的内容,收集修改了一些做一个小教程,效果看下图哈:

渐变背景
  1. body {
  2.   /* 100%窗口高度 */
  3.   height: 100vh;

  4.   /* 更深的色调和不同的渐变方向 */
  5.   background: linear-gradient(45deg, #2C3E50, #2980B9, #8E44AD, #E74C3C);

  6.   /* 指定背景图像的大小 */
  7.   background-size: 400% 400%;

  8.   /* 执行动画:动画名 时长 缓动函数 无限次播放 */
  9.   animation: action 30s ease-in-out infinite;
  10. }

  11. /* 定义动画 */
  12. @keyframes action {
  13.   0% {
  14.     background-position: 0% 50%;
  15.   }
  16.   50% {
  17.     background-position: 100% 50%;
  18.   }
  19.   100% {
  20.     background-position: 0% 50%;
  21.   }
  22. }
复制代码
使用方法一:
直接复制上述代码至sunpanel的自定义CSS窗口处保存即可。




使用方法二:
保存上述代码为bk.css文件,存放至sunpanel安装目录的./conf/custom/文件夹下,随后在sunpanel个性化设置-页脚自定义窗口中的</head>标签上方添加下面的代码,随后刷新sunpanel即可:

  1. <link rel="stylesheet" href="/custom/bk.css">
复制代码
鼠标悬停动画
  1. /*鼠标悬停动画 */

  2. /* 当鼠标悬停在图标信息框上时触发动画 */
  3. /* 详细图标摇晃动画 */
  4. .icon-info-box .rounded-2xl:hover {

  5.   -webkit-animation: info-shake-bounce .5s alternate !important;
  6.   -moz-animation: info-shake-bounce .5s alternate !important;
  7.   -o-animation: info-shake-bounce .5s alternate !important;
  8.   animation: info-shake-bounce .5s alternate !important;
  9. }

  10. /* 小图标摇晃动画 */
  11. .icon-small-box .rounded-2xl:hover {
  12.   
  13.   -webkit-animation: small-shake-bounce .5s alternate !important;
  14.   -moz-animation: small-shake-bounce .5s alternate !important;
  15.   -o-animation: small-shake-bounce .5s alternate !important;
  16.   animation: small-shake-bounce .5s alternate !important;
  17. }

  18. /* 定义摇详细图标晃弹跳动画的关键帧 */
  19. @keyframes info-shake-bounce {

  20.   0%,
  21.   100% {
  22.     transform: rotate(0);
  23.   }

  24.   25% {
  25.     transform: rotate(10deg);
  26.   }

  27.   50% {
  28.     transform: rotate(-10deg);
  29.   }

  30.   75% {
  31.     transform: rotate(2.5deg);
  32.   }

  33.   85% {
  34.     transform: rotate(-2.5deg);
  35.   }
  36. }

  37. /* 定义摇小图标晃弹跳动画的关键帧 */
  38. @keyframes small-shake-bounce {

  39.   0%,
  40.   100% {
  41.     transform: rotate(0);
  42.   }

  43.   25% {
  44.     transform: rotate(15deg);
  45.   }

  46.   50% {
  47.     transform: rotate(-15deg);
  48.   }

  49.   75% {
  50.     transform: rotate(5deg);
  51.   }

  52.   85% {
  53.     transform: rotate(5deg);
  54.   }
  55. }
复制代码
使用方法一:
直接复制上述代码至sunpanel的自定义CSS窗口处保存即可。




使用方法二:
保存上述代码为action.css文件,存放至sunpanel安装目录的./conf/custom/文件夹下,随后在sunpanel个性化设置-页脚自定义窗口中的</head>标签上方添加下面的代码,随后刷新sunpanel即可:

  1. <link rel="stylesheet" href="/custom/action.css">
复制代码
网页播放器
网页播放器尝试了各种开源的,还是只有明月浩空网的能用,点这里注册账号,按教程自定义下,免费的也够用了,需要注意我们设置播放器放置在右侧,为sunpanel左侧边栏留出位置避免冲突,然后要开启加载jQuery 。




试了半天,免插件代码用不了哈!




只能用JS代码了,替换下面代码中的yourid为你的播放器ID即可。

  1. var script = document.createElement("script");
  2. script.setAttribute("type","text/javascript");
  3. script.setAttribute("id","myhk");
  4. script.setAttribute("src","https://myhkw.cn/api/player/yourid");
  5. script.setAttribute("key","yourid");
  6. document.documentElement.appendChild(script);
复制代码
使用方法一:
直接复制上述代码至sunpanel的自定义JS窗口处保存即可。




使用方法二:
保存上述代码为myhk.js文件,存放至sunpanel安装目录的./conf/custom/文件夹下,随后在sunpanel个性化设置-页脚自定义窗口中的</body>标签上方添加下面的代码,随后刷新sunpanel即可:

  1. <script src="/custom/myhk.js"></script>  
复制代码







收藏
送赞
分享

发表回复

评论列表(9)

大大,找不到这个:随后在sunpanel个性化设置-页脚自定义窗口中的</head>标签上方添加下面的代码

</head>标签没有啊
昨天 16:47 回复
/uploads/2024/8/10/XXX.ico,这个图标上传到sunpanel之前设置的conf文件夹里面生成的uploads文件里面,复制下路径就好了,修改我敢给的代码在记事本里面修改就可以,修改完粘贴进去  详情 回复
昨天 17:30
你没有自定义页脚,给你参考下我的吧,XXX的地方自己修改下,包括网址、图标、文字  详情 回复
昨天 17:21
感兴趣的看看哈··
5 天前 回复

谢谢分享教程!
5 天前 回复
这个咋没人看了哈哈
前天 15:40 回复
不错,谢谢分享
前天 19:00 回复
你没有自定义页脚,给你参考下我的吧,XXX的地方自己修改下,包括网址、图标、文字
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.    
  5.     <meta charset="UTF-8">
  6.     <style>
  7.         body, html {
  8.             margin: 0;
  9.             padding: 0;
  10.         }
  11.        .site-footer {
  12.             padding: 30px 0;
  13.             text-align: center;
  14.             color: #fff;
  15.         }
  16.        .footer-content {
  17.             display: flex;
  18.             justify-content: center;
  19.         }
  20.        .footer-links {
  21.             margin: 0;
  22.             padding: 0;
  23.             list-style: none;
  24.         }
  25.        .footer-links li {
  26.             display: flex;
  27.             align-items: center;
  28.             margin-bottom: 10px;
  29.         }
  30.        .footer-links a {
  31.             text-decoration: none;
  32.             color: inherit;
  33.             transition: color 0.3s ease;
  34.             display: flex;
  35.             align-items: center;
  36.         }
  37.        .footer-links a:hover {
  38.             color: #ccc;
  39.         }
  40.        .footer-icon {
  41.             width: 35px;
  42.             height: auto;
  43.             margin-right: 15px;
  44.         }
  45.     </style>
  46.     <link rel="stylesheet" href="/custom/bk.css">
  47.     <link rel="stylesheet" href="/custom/action.css">
  48. </head>
  49. <body>
  50.     <footer class="site-footer">
  51.         <div class="footer-content">
  52.             <ul class="footer-links">
  53.                 <li></li>
  54.                 <li>
  55.                     <a href="https://XXX.cn" target="_blank" class="personal-link">
  56.                         <img class="footer-icon" src="/uploads/2024/8/10/XXX.ico" alt="XXX图标">
  57.                         <span><font size="4" color=" #fff" style="font-family: 'STCaiyun'"><b>@ XXX</font></b></span>
  58.                     </a>
  59.                 </li>
  60.             </ul>
  61.         </div>
  62.         
  63.     </footer>
  64.    
  65.    

  66. <script src="/custom/toc.js"></script>     
  67. </body>
  68. </html>
复制代码


昨天 17:21 回复
/uploads/2024/8/10/XXX.ico,这个图标上传到sunpanel之前设置的conf文件夹里面生成的uploads文件里面,复制下路径就好了,修改我敢给的代码在记事本里面修改就可以,修改完粘贴进去
昨天 17:30 回复
找时间再试试,先谢谢了!  详情 回复
昨天 18:32
找时间再试试,先谢谢了!
昨天 18:32 回复
OK。 谢谢了!  详情 回复
昨天 22:06
开心一号 发表于 2024-10-18 18:32
找时间再试试,先谢谢了!

OK。
谢谢了!
昨天 22:06 回复