THẾ GIỚI CÔNG NGHỆ IT


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]

AdminTên: Admin
Cấp bậc: Quản trị diễn đàn
Quản trị diễn đàn

1[Code forumvi] THU GỌN BÀI VIẾT DÀI Empty [Code forumvi] THU GỌN BÀI VIẾT DÀI Sun Sep 14, 2014 12:45 pm

GIỚI THIỆU
Code sẽ tự động tìm và thu gọn các bài viết dài hơn 600px, cho phép bật/tắt dễ dàng.

[Code forumvi] THU GỌN BÀI VIẾT DÀI CnEuo32

BƯỚC 1
Thêm vào CSS
Code:
/* Thu gọn bài viết by devs.forumvi.com */
.baivietdai{overflow:hidden}
.thugon span:hover{cursor:pointer}
.thugon{background-color:#FAFFC7;border:3px double #9ED8FF;clear:both;margin:0;padding:2px 10px}
.viewfull{background:url(//ssl.gstatic.com/ui/v1/zippy/arrow_down.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.viewhide{background:url(//ssl.gstatic.com/ui/v1/icons/mail/arrow_up.png) no-repeat scroll 3px 7px transparent;padding:0 15px}
.fullOff{background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_10.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}
.fullOn{background:url(http://i48.servimg.com/u/f48/16/58/89/73/power_11.png) no-repeat scroll 0 2px transparent;margin-top:-2px;padding:2px 5px 2px 20px}

BƯỚC 2
Tạo file javascript và đặt In the topics
Code:
/* Thu gọn bài viết by devs.forumvi.com */
$(function () {
  $(".postbody .post-entry").each(function () {
      600 <= $(this).height() && $(this).addClass("baivietdai").height(310).after('<p class="thugon"><span><span class="viewfull">Chi tiết</span><span class="viewhide" style="display:none">Thu gọn</span></span><span><span class="fullOff" style="float:right">Tắt thu gọn</span><span class="fullOn" style="float:right;display:none">Bật thu gọn</span></span></p>')
  });
  "100%" == my_getcookie("thugonbaiviet") && ($(".fullOn, .viewhide,.fullOff, .viewfull").toggle(), $(".baivietdai").height("100%"));
  $(".viewfull, .viewhide, .fullOff, .fullOn").click(function () {
      var c = "100%",
        a = $(this),
        b = a.attr("class");
      if ("viewhide" == b || "fullOn" == b) c = 310;
      "fullOff" == b || "fullOn" == b ? (my_setcookie("thugonbaiviet", c, !0), $(".fullOff, .fullOn").toggle()) : (a.closest(".thugon").prev().height(c), $(window).scrollTop(a.closest(".post").offset().top));
      a.hide().siblings().show()
  })
});

https://hotromaytinh.forumvi.com

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]

Bài viết mới cùng chuyên mục

Bài viết liên quan

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