Myzod Zone

 找回密码
 立即注册
查看: 1204|回复: 0

Discuz! X3.4网页自适应代码

[复制链接]

1

主题

1

帖子

2万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
21442
发表于 2020-12-29 21:59:41 | 显示全部楼层 |阅读模式
  • 后台设置站点宽窄风格为“宽屏(自由宽度)”
  • 将以下代码放到后台统计代码里:
  1. <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.slim.min.js"></script>
  2. <script>var jq = jQuery.noConflict();</script>
  3. <script>
  4.   jq(document).ready(function () {
  5.     jq("head").append('<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">')
  6.     jq("head").append('<style>.tedt{width:100% !important; max-width:600px}</style>')
  7.     jq("head").append('<style>.quote{width:100% !important}</style>')
  8.     jq("#toptb").css("min-width", "0")
  9.     jq(".hdc.cl").css("min-height", "0")
  10.     jq(".wp").css("min-width", "0")
  11.     jq(".zoom").css("width", "100%")
  12.     jq(".zoom").css("max-width", "600px")
  13.     jq(".attach_nopermission.attach_tips").css("width", "100%")
  14.     jq(".attach_nopermission.attach_tips").css("max-width", "600px")
  15.     jq(".tedt.mtn").css("width", "100%")
  16.     jq(".tedt.mtn").css("max-width", "600px")
  17.     jq("#scrolltop").children("span:eq(0)").children("a").attr("onclick", "void(0)")
  18.     resized()
  19.   })
  20.   window.addEventListener("resize", resized)
  21.   function resized() {
  22.     if (jq(document).width() <= 650) {
  23.       jq("#online").hide()
  24.       jq("#qmenu").hide()
  25.       jq("#um").children("p:eq(1)").hide()
  26.       jq("#um").css("padding-right", "0")
  27.       jq("#scbar_txt").css("width", "calc(100vw - 145px)")
  28.       jq(".scbar_hot_td").hide()
  29.       jq(".fl_i").hide()
  30.       jq(".fl_by").hide()
  31.       jq(".hdc.cl").children("h2").children("a").children("img").css("height", "32px")
  32.       jq("#chart").hide()
  33.       jq("#loginstatus").hide()
  34.       jq(".avt.y").hide()
  35.       jq(".y.pns").children("table").children("tbody").children("tr:eq(0)").hide()
  36.       jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(0)").hide()
  37.       jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(1)").hide()
  38.       jq("#frt").hide()
  39.       jq(".by").hide()
  40.       jq(".num").hide()
  41.       jq(".bm_h.cl").children(".y").hide()
  42.       jq("#toptb").children(".wp").children(".y").hide()
  43.       jq(".pls").hide()
  44.       jq("#fj").hide()
  45.       jq("#fastsmiliesdiv").hide()
  46.       jq("#fastposteditor").css("margin-right", "0")
  47.       jq("#p_btn").hide()
  48.     } else {
  49.       jq("#online").show()
  50.       jq("#qmenu").show()
  51.       jq("#um").children("p:eq(1)").show()
  52.       jq("#um").css("padding-right", "60px")
  53.       jq("#scbar_txt").css("width", "400px")
  54.       jq(".scbar_hot_td").show()
  55.       jq(".fl_i").show()
  56.       jq(".fl_by").show()
  57.       jq(".hdc.cl").children("h2").children("a").children("img").css("height", "66px")
  58.       jq(".pipe").show()
  59.       jq("#chart").show()
  60.       jq("#loginstatus").show()
  61.       jq(".avt.y").show()
  62.       jq(".y.pns").children("table").children("tbody").children("tr:eq(0)").show()
  63.       jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(0)").show()
  64.       jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(1)").show()
  65.       jq("#frt").show()
  66.       jq(".by").show()
  67.       jq(".num").show()
  68.       jq(".bm_h.cl").children(".y").show()
  69.       jq("#toptb").children(".wp").children(".y").show()
  70.       jq(".pls").show()
  71.       jq("#fj").show()
  72.       jq("#fastsmiliesdiv").show()
  73.       jq("#fastposteditor").css("margin-right", "170px")
  74.       jq("#p_btn").show()
  75.     }
  76.   }
  77. </script>
复制代码



回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|MyZod

GMT+8, 2024-7-27 14:50 , Processed in 0.101480 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020

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