国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > Discuz > 正文

Discuz!X帖子內容頁增加閱讀全文功能

2024-09-11 09:04:33
字體:
來源:轉載
供稿:網友
很多小伙伴可能碰到在看帖的時候帖子很長,鼠標滾輪滾很多次也看不到底的情況,這時候我們可以在帖子內容頁增加閱讀全文功能,實現非常簡單,由于沒有合適的嵌入點,不能做成插件,只能自己修改代碼了,實現起來很簡單,代碼如下:
一、找到 你的模板目錄/forum/viewthread_node_body.htm,打開這個文件,找到第58行,
  1.   
    <div class="{if !$_G[forum_thread][special]}t_fsz{else}pcbs{/if}">
復制代碼
給這個div增加一個id
  1.  
     <div class="{if !$_G[forum_thread][special]}t_fsz{else}pcbs{/if}" {if $post['first']}id="rt"{/if}>
復制代碼

{if $post['first']}{/if}這個判斷是為了保證代碼只在樓主這層有效。

二、找到第180行,
  1.   
    <div id="comment_$post[pid]" class="cm">
復制代碼
在此之前粘貼以下代碼
  1.     <!--{if $post['first']}-->    <div class="read_all pbw cl" >        <div class="read_more_mask"></div>        <a class="read_more_btn" target="_self">閱讀全文</a>    </div>  <script type="text/javascript">  jq(function(){    var widHeight = jq(window).height();    var artHeight = jq('#rt').height();    if(artHeight>(widHeight * 2.5)){      jq('#rt').height(widHeight * 2.5 - 260).css({'overflow':'hidden'});      var article_show = true;      jq('.read_more_btn').on('click',bindRead_more);    }else{      article_show = true;      jq('.read_all').hide().addClass('readall_box_nobg');    }    function bindRead_more(){      if(!article_show){        jq('#rt').height(widHeight * 2.5).css({'overflow':'hidden'});        jq('.read_all').show().removeClass('readall_box_nobg');        article_show = true;      }else{        jq('#rt').height("").css({'overflow':'hidden'});        jq('.read_all').show().addClass('readall_box_nobg');        jq('.read_all').hide().addClass('readall_box_nobg');        article_show = false;      }    }  })    </script>    <!--{/if}-->復制代碼

三、css樣式如下
找到 你的模板目錄/common/module.css 或 模板目錄/common/extend_module.css,粘貼一下代碼即可。
  1. /** forum::viewthread,group::viewthread **//*閱讀全文按鈕*/.read_all { position: relative; margin-top: -200px;  z-index:999; text-align: center; }.read_all .read_more_mask { height: 200px; background: -moz-linear-gradient(bottom,rgba(255,255,255,0.1),rgba(255,255,255,0)); background: -webkit-gradient(linear,0 top,0 bottom,from(rgba(255,255,255,0)),to(#fff)); background: -o-linear-gradient(bottom,rgba(255,255,255,0.1),rgba(255,255,255,0)); }.read_more_btn { display:inline-block; padding:0 20px; background: #fff; border-radius: 4px; border: 1px solid {HIGHLIGHTLINK}; cursor:pointer; font-size: 16px; color:{HIGHLIGHTLINK}; line-height: 32px; }.read_more_btn:hover { background:{HIGHLIGHTLINK}; color:#fff; text-decoration:none;  }/** end **/
   
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 四会市| 鱼台县| 南康市| 托里县| 界首市| 哈密市| 平江县| 广南县| 安塞县| 新巴尔虎右旗| 万源市| 龙川县| 吴忠市| 沧州市| 昌平区| 马边| 永兴县| 阿拉善右旗| 汉中市| 文登市| 汉沽区| 安宁市| 舒城县| 临洮县| 枣阳市| 固阳县| 项城市| 南木林县| 永德县| 乌恰县| 西盟| 西和县| 崇州市| 霍山县| 西青区| 孝昌县| 巧家县| 夏河县| 陇西县| 江都市| 嘉兴市|