优化dz x5导读首页各区域标题展示为一行 New

[复制链接]
101 |1
发表于 昨天 17:27 | 显示全部楼层 |阅读模式
今天,总算是微信能登录跳转到pc端网页了,分享一下,这几天的折腾,下面是上午折腾出来的。

使用 Trae解决导读首页各内容区域的展示问题。实现标题集中在一行显示。默认是展开,一个标题区一个标题区。
Trae 解决了:

- 1.所有标题在一行水平显示,支持滚动。
- 2.鼠标划动到标题上时,显示对应标题下的内容。
- 3.为标题设置了宽度不超过21%的限制。
- 4.添加了指定的渐变背景色和圆角效果。
- 5.添加了白色1px边框。
- 6.为"更多"链接设置了较小的字体和较浅的颜色。
  
下面分享原始代码:

                            .guide-tabs-container {                        display: flex;                        overflow-x: auto;                        white-space: nowrap;                        margin-bottom: 15px;                        padding: 5px;                }                .guide-tab {                        flex: 0 0 auto;                        width: 21%; /* 宽度不超过21% */                        min-width: 150px; /* 最小宽度,确保内容不会被压缩得太小 */                        padding: 10px 20px;                        cursor: pointer;                        position: relative;                        background: linear-gradient(132deg,rgba(235,237,240,0.85) 9.65%,rgba(233,236,238,0.5) 58.96%,rgba(254,254,255,0.87) 86.15%);                        border-radius: 5px;                        border: 1px solid white;                        margin-right: 10px;                        transition: all 0.3s ease;                        display: flex;                        justify-content: space-between;                        align-items: center;                }                .guide-tab:hover {                        box-shadow: 0 2px 5px rgba(0,0,0,0.1);                }                .guide-tab.active {                        background: linear-gradient(132deg,rgba(220,225,230,0.85) 9.65%,rgba(215,220,225,0.5) 58.96%,rgba(240,245,250,0.87) 86.15%);                        font-weight: bold;                }                .guide-content {                        display: none;                        padding: 15px 0;                }                .guide-content.active {                        display: block;                }                /* 更多链接样式 */                .guide-tab .more-link {                        font-size: 12px; /* 字体小一点 */                        color: #888; /* 颜色比主标题浅 */                        text-decoration: none;                }                .guide-tab .more-link:hover {                        color: #555;                        text-decoration: underline;                }                /* 隐藏滚动条但保留功能 */                .guide-tabs-container::-webkit-scrollbar {                        display: none;                }                .guide-tabs-container {                        -ms-overflow-style: none;                        scrollbar-width: none;                }                                                                                                        {lang guide_hot}{lang guide_digest}{lang guide_newthread}{lang guide_new}{lang guide_my}                                                {lang more} »                                                                                                                                                                                                                                                                                                                                $thread[heats]{lang guide_attend}                                                $thread[lastpost]                                                                                · $thread[subject] $list['forumnames'][$thread[fid]]['name']                                                                                                                        {lang guide_nothreads}                                                                        jQuery(document).ready(function($) {                // 默认显示第一个标签的内容                $('.guide-tab').first().addClass('active');                $('.guide-content').first().addClass('active');                // 鼠标划动显示对应内容                $('.guide-tab').hover(function() {                        // 移除所有激活状态                        $('.guide-tab').removeClass('active');                        $('.guide-content').removeClass('active');                        // 添加当前激活状态                        $(this).addClass('active');                        var target = $(this).data('target');                        $('#' + target).addClass('active');                });        });        


在导读首页文件,找到:,下面div标签,在这整个div标签里,上,替换上面内容,即可。
因原始文件更改过,查看默认模板文件好象54-83行。
其它细节,你还可以自己继续优化。
回复

使用道具 举报

发表于 昨天 17:28 | 显示全部楼层
下面是效果截图:



总体感觉,比一整个页面都是标题,来得美观些。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表