子比主题美化 – 侧边悬浮排行榜1年前发布12882子比主题美化 – 侧边悬浮排行榜此内容为付费阅读,请付费后查看1000积分黄金会员800钻石会员500登录购买供学习和研究使用,请在下载后24小时内删除 购买前可以联系作者确认资源信息,防止交易矛盾 付费阅读已售 9 简介 初一桑从macgf看到的,感觉还可以,手动操作仿了一个,喜欢的话可以支持一下~ 教程 首先是CSS部分: /*左悬浮排行榜*/ .fix-left { position:fixed; top:150px; left:10px; z-index:10; } .fix-item { width:50px; height:68px; background-color:#fff; box-shadow:0 5px 10px 0 rgba(0,0,0,.1); margin-bottom:20px; border-radius:15px; transition:all .2s; } .item-title { text-align:center; overflow:hidden; cursor:pointer; position:relative; color:#333; } img[data-v-3b17862b] { width:30px; display:block; margin:8px auto 0; } span[data-v-3b17862b] { font-size:12px; } i[data-v-3b17862b] { display:none; position:absolute; width:30px; height:30px; line-height:30px; text-align:center; right:0; top:0; color:#fff; } .rank-box[data-v-3b17862b] { display:none; padding:0 10px; height:350px; overflow-y:auto; background-color:#fff; box-shadow:0 5px 10px 0 rgba(0,0,0,.1); border-bottom-right-radius:15px; border-bottom-left-radius:15px; } ul[data-v-3b17862b] { list-style:none; } li[data-v-3b17862b] { border-bottom:1px solid #f3e9e961; padding:8px 0; } .img[data-v-3b17862b] { float:left; width:100%; height:100%; overflow:hidden; margin-right:8px; } .img img[data-v-3b17862b] { width:100%; height:100%; } ul li .title[data-v-3b17862b] { overflow:hidden; height:32px; font-size:12px; line-height:16px; color:#333; } .fix-left .fix-item.active[data-v-3b17862b] { width:280px; } .fix-left .fix-item.active .item-title[data-v-3b17862b] { height:60px; line-height:60px; background-color:#333; color:#fff; border-top-left-radius:15px; border-top-right-radius:15px; } .fix-left .fix-item.active .item-title img[data-v-3b17862b] { display:inline-block; margin:0 15px 0 0; } .fix-left .fix-item.active .item-title span[data-v-3b17862b] { font-size:14px; } .fix-left .fix-item.active .item-title i[data-v-3b17862b],.fix-left .fix-item.active .rank-box[data-v-3b17862b] { display:block } .enlighter-default .enlighter { max-height:400px; overflow-y:auto !important; } .posts-item .item-heading>a { font-weight:bold; color:unset; } @media (max-width:640px) { .meta-right .meta-view { display:unset !important; } } a.class-item.js-rank { display: block; width: 100%; height: 80px; display: flex; align-items: center; margin-bottom: 20px; } .class-info { width: 190px; font-size: 12px; } .name { line-height: 20px; font-weight: 400; margin-bottom: 2px; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; overflow: hidden; -webkit-box-orient: vertical; font-size: 15px; } img.class-pic { width: 90px; border-radius: 8px; margin-right: 5px; } a.class-item.js-rank { display: block; width: 100%; height: 80px; display: flex; align-items: center; margin-bottom: 20px; } 然后是JS // 获取元素 var element = document.getElementById("macgf_cb_bd"); // 添加点击事件监听器 element.addEventListener("click", function() { // 切换 class if (element.classList.contains("active")) { element.classList.remove("active"); } else { element.classList.add("active"); } }); document.getElementById("macgf_cb_ht").addEventListener("click", function() { // 跳转到指定网址 window.location.href = "你的首页网址"; }); document.addEventListener("DOMContentLoaded", function() { var divElement = document.getElementById("macgf_cb_ht"); // 获取当前页面的完整URL var currentPageUrl = window.location.href; // 指定的首页URL var homepageUrl = "你的首页网址"; // 检查当前页面是否为首页 if (currentPageUrl !== homepageUrl) { // 如果是首页,则显示 div 元素 divElement.style.display = "block"; } else { // 如果不是首页,则隐藏 div 元素 divElement.style.display = "none"; } }); 接下来则是PHP代码方面 放置于func.php内 此处内容已隐藏,请付费后查看 温馨提示:本文最后更新于2024-04-14 15:39:05,某些文章具有时效性,若有错误或已失效,请私信客服或联系知新社长。 © 版权声明文章版权归作者所有,未经允许请勿转载。 四月 14 知岛上的今时往日 "吼吼~,往年的今天,作者不知道跑哪里偷懒去了~" THE END子比主题网站/配置/代码 喜欢就支持一下吧点赞2 分享QQ空间微博QQ好友海报分享复制链接收藏3