You are not connected. Please login or register

View previous topic View next topic Go down Message [Page 1 of 1]

Moderators

1[TUTs] Thu gọn bài viết dài Empty [TUTs] Thu gọn bài viết dài Fri Jul 11, 2014 5:45 pm

Moderators
Moderators Quản Lý Viên

Tổng số bài gửi : 96

VNĐ : 257

Uy tín : 9

Gia Nhập : 2013-07-27

demo: [TUTs] Thu gọn bài viết dài 3WA1Ahk
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}
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()
  })
});
Nguồn :DEVS

View previous topic View next topic Back to top Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum