admin [—»Sói™~]-[Ðại Ma Ðầu]
Giới tính : Chinese zodiac : Bài viết : 1042 Xu : 158 Thanked : 650 Sinh Nhật : 20/09/1990 Tham Gia : 15/07/2011 Tuổi : 34 Yahoo : Hà Nội Nghề Nghiệp : Giáo Sư Status : hgfggggggggggggg
Character sheet Tài Sản:
| Tiêu đề: [Codes] Thu gọn bài viết và chữ ký Tue Oct 25, 2011 7:49 pm | |
| 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: [You must be registered and logged in to see this link.]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}[table width="90%" align="center" border="0" cellpadding="0" cellspacing="1"][tr][/tr][/table] 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> | |
|