Discuz! X3.4默認(rèn)模板自適應(yīng)手機(jī)與pc的方法

個(gè)人感覺PC這個(gè)主題顯示在手機(jī)里更美觀。同時(shí)自己又不想裝一堆第三方主題,這個(gè)剛好
代碼如下:
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.slim.min.js"></script> <script>var jq = jQuery.noConflict();</script> <script> jq(document).ready(function () { jq("head").append('<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">') jq("head").append('</p> <style>.tedt{width:100% !important; max-width:600px}</style> <p>') jq("head").append('</p> <style>.quote{width:100% !important}</style> <p>') jq("#toptb").css("min-width", "0") jq(".hdc.cl").css("min-height", "0") jq(".wp").css("min-width", "0") jq(".zoom").css("width", "100%") jq(".zoom").css("max-width", "600px") jq(".attach_nopermission.attach_tips").css("width", "100%") jq(".attach_nopermission.attach_tips").css("max-width", "600px") jq(".tedt.mtn").css("width", "100%") jq(".tedt.mtn").css("max-width", "600px") jq("#scrolltop").children("span:eq(0)").children("a").attr("onclick", "void(0)") resized() }) window.addEventListener("resize", resized) function resized() { if (jq(document).width() <= 650) { jq("#online").hide() jq("#qmenu").hide() jq("#um").children("p:eq(1)").hide() jq("#um").css("padding-right", "0") jq("#scbar_txt").css("width", "calc(100vw - 145px)") jq(".scbar_hot_td").hide() jq(".fl_i").hide() jq(".fl_by").hide() jq(".hdc.cl").children("h2").children("a").children("img").css("height", "32px") jq("#chart").hide() jq("#loginstatus").hide() jq(".avt.y").hide() jq(".y.pns").children("table").children("tbody").children("tr:eq(0)").hide() jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(0)").hide() jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(1)").hide() jq("#frt").hide() jq(".by").hide() jq(".num").hide() jq(".bm_h.cl").children(".y").hide() jq("#toptb").children(".wp").children(".y").hide() jq(".pls").hide() jq("#fj").hide() jq("#fastsmiliesdiv").hide() jq("#fastposteditor").css("margin-right", "0") jq("#p_btn").hide() } else { jq("#online").show() jq("#qmenu").show() jq("#um").children("p:eq(1)").show() jq("#um").css("padding-right", "60px") jq("#scbar_txt").css("width", "400px") jq(".scbar_hot_td").show() jq(".fl_i").show() jq(".fl_by").show() jq(".hdc.cl").children("h2").children("a").children("img").css("height", "66px") jq(".pipe").show() jq("#chart").show() jq("#loginstatus").show() jq(".avt.y").show() jq(".y.pns").children("table").children("tbody").children("tr:eq(0)").show() jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(0)").show() jq(".y.pns").children("table").children("tbody").children("tr:eq(1)").children("td:eq(1)").show() jq("#frt").show() jq(".by").show() jq(".num").show() jq(".bm_h.cl").children(".y").show() jq("#toptb").children(".wp").children(".y").show() jq(".pls").show() jq("#fj").show() jq("#fastsmiliesdiv").show() jq("#fastposteditor").css("margin-right", "170px") jq("#p_btn").show() } } </script>
使用方法:將以下代碼放入后臺統(tǒng)計(jì)即可
我去,帖子內(nèi)容不能放js代碼,我只好放我論壇帖子鏈接了,版主見諒,放了js代碼提示帖子有危險(xiǎn),發(fā)不了
https://discuzx.qvdd.cn/thread-3-1-1.html
大家可以順便用手機(jī)的尺寸體驗(yàn)一下這個(gè)網(wǎng)頁
yomkk大佬:
感覺比默認(rèn)的觸屏版要好用
zgs大佬:
這是改了改比例嗎
看著好mini
programer大佬:
這是改了改比例嗎
看著好mini
字體大小沒改,圖片和邊框改成自適應(yīng),在手機(jī)上看挺舒服的
programer大佬:
感覺比默認(rèn)的觸屏版要好用
是啊,看著很親切。觸屏版那個(gè)感覺是10年前的手機(jī)網(wǎng)頁。。
micto大佬:
樓主你的思路好,但是建議換方式來實(shí)現(xiàn),不要用JS。
另外meta標(biāo)簽不要用JS,直接寫在模板里,或者配置到后臺設(shè)置里。
其他的部分用CSS來實(shí)現(xiàn)。
失足大叔大佬:
現(xiàn)在還能做論壇嗎
相關(guān)文章
Discuz! X3.4默認(rèn)模板自適應(yīng)手機(jī)與pc的方法
這是我去年自己花了一個(gè)下午一點(diǎn)點(diǎn)研究出來的,現(xiàn)在免費(fèi)貢獻(xiàn)給大家試用,代碼放入后臺統(tǒng)計(jì)即可,效果如下2020-11-16- 如果想要404頁面跟網(wǎng)站其他頁面一樣帶有頂部和底部導(dǎo)航,能顯示用戶信息怎么辦呢?今天小編就為大家介紹discuz設(shè)置嵌入式404頁面教程,來看看吧2016-05-10
Discuz X3/3.1 門戶中的Keyword和Description顯示不正確的解決方法
這篇文章主要介紹了Discuz X3/3.1 門戶中的Keyword和Description顯示不正確的解決方法,默認(rèn)顯示的是游客能看到的,而Discuz 對游客屏蔽了關(guān)鍵詞與描述,為了SEO,還是讓它正常2015-03-25Discuz提示您安裝的不是正版應(yīng)用問題解決辦法
這篇文章主要介紹了Discuz提示您安裝的不是正版應(yīng)用問題解決辦法,完整提示“對不起,您安裝的不是正版應(yīng)用,安裝程序無法繼續(xù)執(zhí)行”,本文使用修改PHP文件的方法解決了這個(gè)2015-03-25- 這篇文章主要介紹了Discuz和jQuery變量名沖突的3種解決方法,在開發(fā)模板或者插件時(shí)經(jīng)常遇到這個(gè)問題,本文列出的3種方法都可以解決這個(gè)問題,需要的朋友可以參考下2015-03-25
Discuz提示“密碼錯(cuò)誤次數(shù)過多,請15分鐘后重新登陸”問題解決方法
這篇文章主要介紹了Discuz提示“密碼錯(cuò)誤次數(shù)過多,請15分鐘后重新登陸”問題解決方法,本文方法適合網(wǎng)站管理員操作,不是普通網(wǎng)友可以使用的解決方法,需要的朋友可以參考下2015-03-25Discuz X2通過數(shù)據(jù)庫批量替換修改帖子內(nèi)容
帖子數(shù)量上萬,一開始是通過設(shè)置詞語過濾,發(fā)現(xiàn)無效果,只能通過數(shù)據(jù)庫批量替換了,具體方法請接著往下看2014-09-04Discuz!X3.2版設(shè)置論壇QQ在線客服號碼無法發(fā)起聊天的問題解決辦法
這篇文章主要介紹了Discuz!X3.2版設(shè)置論壇QQ在線客服號碼無法發(fā)起聊天的問題解決辦法,需要的朋友可以參考下2014-08-03- 這篇文章主要為大家介紹了Discuz論壇發(fā)帖技巧,需要的朋友可以參考下2014-06-21
- 這篇文章主要為大家介紹了Discuz論壇宣傳與優(yōu)化技巧,需要的朋友可以參考下2014-06-21