[Thông báo] Chuyển diễn đàn


Diễn đàn về free Code sẽ chuyển sang ICT2.net







You are not connected. Please login or register

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down  Thông điệp [Trang 1 trong tổng số 1 trang]

Founder

Founder
Admin
Admin
Loading
Chức năng của code này là thu gọn bài viết dài hơn 500px lại, đồng thời hiện một nút Chi tiết.
Khi click vào nút này thì bài viết sẽ hiển thị toàn bộ và nút bấm cũng mất đi.
Với chữ ký thì code sẽ ẩn phần chữ ký dài hơn 300px, khi rê chuột vào sẽ hiện kích thước thật, và trở lại kích thước thu gọn khi rê chuột ra ngoài.
Demo:
Code:
http://www.www.fmvi.tk/t140-thu-gn-bai-vit-va-ch-ky#555
ACP - Modules - HTML & JAVASCRIPT - Javascript codes management:
  • Title: Thu gọn bài viết và chữ ký
  • Placement: In the topics
  • Javascript Code: Tuỳ theo phiên bản đang dùng để lấy code thích hợp
    • phpBB2:
      Code:
      $(function(){$("div.postbody div:not('.cont_code')").each(function(){var $baivietdai=$(this);if($(this).height()>500){$(this).css({'overflow':'hidden','max-height':'300px'});$('<br/><button style="float:right; padding:1px" class="baivietquadai"><img title="Xem bài viết chi tiết" src ="http://i48.servimg.com/u/f48/16/58/89/73/more10.gif" alf="chi tiết"/></button>').insertAfter(this);$('.baivietquadai').click(function(){$baivietdai.css({'overflow':'hidden','max-height':'100%'});$(this).remove()})}});$('div.signature_div').each(function(){if($(this).height()>350){$('div.signature_div img').css('max-width','600px');$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'});$(this).hover(function(){$(this).css({'overflow':'hidden','max-height':'100%','max-width':'100%'})},function(){$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'})})}})});
    • phpBB3:
      Code:
      $(function(){$("div.content").each(function(){var $baivietdai=$(this);if($(this).height()>500){$(this).css({'overflow':'hidden','max-height':'300px'});$('<br/><button style="float:right; padding:1px" class="baivietquadai"><img title="Xem bài viết chi tiết" src ="http://i48.servimg.com/u/f48/16/58/89/73/more10.gif" alf="chi tiết"/></button>').insertAfter(this);$('.baivietquadai').click(function(){$baivietdai.css({'overflow':'hidden','max-height':'100%'});$(this).remove()})}});$('div.signature_div').each(function(){if($(this).height()>350){$('div.signature_div img').css('max-width','600px');$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'});$(this).hover(function(){$(this).css({'overflow':'hidden','max-height':'100%','max-width':'100%'})},function(){$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'})})}})});
    • punBB:
      Code:
      $(function(){$("div.entry-content").each(function(){var $baivietdai=$(this);if($(this).height()>500){$(this).css({'overflow':'hidden','max-height':'300px'});$('<br/><button style="float:right; padding:1px" class="baivietquadai"><img title="Xem bài viết chi tiết" src ="http://i48.servimg.com/u/f48/16/58/89/73/more10.gif" alf="chi tiết"/></button>').insertAfter(this);$('.baivietquadai').click(function(){$baivietdai.css({'overflow':'hidden','max-height':'100%'});$(this).remove()})}});$('div.sig-content').each(function(){if($(this).height()>350){$('div.signature_div img').css('max-width','600px');$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'});$(this).hover(function(){$(this).css({'overflow':'hidden','max-height':'100%','max-width':'100%'})},function(){$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'})})}})});
    • Invision:
      Code:
      $(function(){$("div.post-entry").each(function(){var $baivietdai=$(this);if($(this).height()>500){$(this).css({'overflow':'hidden','max-height':'300px'});$('<br/><button style="float:right; padding:1px" class="baivietquadai"><img title="Xem bài viết chi tiết" src ="http://i48.servimg.com/u/f48/16/58/89/73/more10.gif" alf="chi tiết"/></button>').insertAfter(this);$('.baivietquadai').click(function(){$baivietdai.css({'overflow':'hidden','max-height':'100%'});$(this).remove()})}});$('div.signature_div').each(function(){if($(this).height()>350){$('div.signature_div img').css('max-width','600px');$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'});$(this).hover(function(){$(this).css({'overflow':'hidden','max-height':'100%','max-width':'100%'})},function(){$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'})})}})});
    • Tùy chỉnh:
      Code:
      $(function(){$(".noidungbaiviet").each(function(){var $baivietdai=$(this);if($(this).height()>500){$(this).css({'overflow':'hidden','max-height':'300px'});$('<br/><button style="float:right; padding:1px" class="baivietquadai"><img title="Xem bài viết chi tiết" src ="http://i48.servimg.com/u/f48/16/58/89/73/more10.gif" alf="chi tiết"/></button>').insertAfter(this);$('.baivietquadai').click(function(){$baivietdai.css({'overflow':'hidden','max-height':'100%'});$(this).remove()})}});$(".noidungchuky").each(function(){if($(this).height()>350){$('.noidungchuky img').css('max-width','600px');$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'});$(this).hover(function(){$(this).css({'overflow':'hidden','max-height':'100%','max-width':'100%'})},function(){$(this).css({'overflow':'hidden','max-height':'250px','max-width':'100%'})})}})});
      Đối với những forum có chỉnh sửa Templates (phpBB2, punBB). Nếu không dùng được các code đã chia sẽ thì các bạn có thể tự điều chỉnh bằng code tùy chỉnh này.
      ACP - Display - Templates - viewtopic_body:
      • phpBB2: Tìm trong viewtopic_body:
        Code:
        {postrow.displayed.MESSAGE}
        Thay bằng
        Code:
        <div class="noidungbaiviet">{postrow.displayed.MESSAGE}</div>
        Tìm :
        Code:
        {postrow.displayed.SIGNATURE}
        Thay bằng
        Code:
        <div class="noidungchuky">{postrow.displayed.SIGNATURE}</div>
      • punBB: Tìm trong viewtopic_body:
        Code:
        {postrow.displayed.MESSAGE}
        Thay bằng
        Code:
        <div class="noidungbaiviet">{postrow.displayed.MESSAGE}</div>
        Tìm :
        Code:
        {postrow.displayed.SIGNATURE_NEW}
        Thay bằng
        Code:
        <div class="noidungchuky">{postrow.displayed.SIGNATURE_NEW}</div>

Viết bởi baivong - FMvi.tk

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang  Thông điệp [Trang 1 trong tổng số 1 trang]

Permissions in this forum:
Bạn không có quyền trả lời bài viết