找回密码
 注册免广告
搜索
🔥英国交易所 100 英镑羊毛华侨银行 15 新加坡币 🔥熊猫速汇 50 元券 🔥ByBit 交易所羊毛🐑
MyFin 5 欧元羊毛 🔥人人必备的 Wise 💳Wirex 银行卡,送 $45 美元最便宜的 eSIM 流量手机号 📱
个人 IBAN 出金,注册送 $25 比特币 ฿数字货币银行卡,注册送 7 美元💲IBKR开户送 $1000 股票 
查看: 1706|回复: 0

Discuz! X3.5手机自适应网页代码

[复制链接]

9

主题

18

回帖

437

积分

管理员

积分
437
admin 发表于 2023-3-11 16:36:40 | 显示全部楼层 |阅读模式

注册免广告

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

×
  • 新增 /template/default/common/extend_common.css 文件放入如下代码:
    1. body, #toptb {min-width: 0 !important}
    2. .wp {width: 1200px !important; max-width: 100% !important}
    3. img.zoom, #e_image_menu {max-width: 100% !important; height: auto !important}
    4. .btn_s_open, .btn_s_close, #qmenu {display: none !important}
    5. .pcht {max-width: 100%}
    6. .a_t td {padding: 4px !important}
    7. ul.xl.xl2.o.cl { display: none !important }
    8. @media (max-width: 767px) {
    9.   .m_c .tedt, #subjecthide, .m_c .quote, .rfm {width:100%!important}
    10.   #frt, .fl_i, .num, #boardlogo, .category_l3, .pls, tr td:nth-last-child(3).by, tr.ts td:nth-last-child(-n+2) {display: none !important}
    11.   #scbar_txt, .ct2_a .mn, .f_c.altw, .c, .f_c .list {width: auto !important}
    12.   #wp, #ft, .hdc.cl {padding: 0 10px !important; box-sizing: border-box}
    13.   .rfm th {width: 5em !important}
    14.   .pm {width: 360px !important}
    15.   .ptm img {max-width: 100% !important}
    16. }

    17. @media (max-width: 392px) {
    18.   .fl_by {display: none !important}
    19. }
    复制代码

  • 修改 /template/default/common/header.htm 文件,在其 </head> 标签前添加代码
    1. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
    复制代码

  • 后台统计代码增加
    1. <script>
    2.   const mobileWidth = 767
    3.   if (window.innerWidth<=mobileWidth) {
    4.     if (!document.cookie.includes('close_leftinfo=1')) {
    5.       setcookie('close_leftinfo', 1)
    6.       location.reload()
    7.     }
    8.   } else {
    9.     if (document.cookie.includes('close_leftinfo=1')) {
    10.       setcookie('close_leftinfo', 2)
    11.       location.reload()
    12.     }
    13.   }
    14. </script>
    复制代码

  • 站点宽窄风格改成窄屏(固定宽度),允许用户自由切换改成否
  • 作者用户名显示位置改成显示在帖子内部
  • 快速发帖右侧显示推荐表情改成否
  • 左侧信息栏允许用户控制 改为 是
  • 仅适用于Discuz! X3.5默认主题,不适用3.4
  • 如果没有生效,后台更新一下模板的CSS缓存
您需要登录后才可以回帖 登录 | 注册免广告

本版积分规则

排行榜|意见建议|数字居民论坛

GMT+8, 2024-10-1 17:22

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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