Thứ Bảy, 19 tháng 9, 2015

Recent comment đơn giản cho blogspot

Recent comment đơn giản cho blogspot
Chào bạn! Ở bài viết này Khánh sẽ giới thiệu đến bạn một widget quen thuộc đối với một blogger đó chính là Recent comment. Ở phiên bản này, Widget recent comment của chúng ta sẽ trở nên rất đơn giản và nhẹ nhàng với ảnh avatar được bo góc, hiển thị số ký tự đầu của comment được rút gọn. Và điều tuyệt vời hơn hết là bạn hoàn toàn có thể tùy chỉnh các thông số trên một cách dễ dàng. Bạn có thể xem thử
DEMO

Để thêm widget recent comment cho blogspot của bạn, bạn vào Bố cục > Thêm tiện ích > HTML/Javarscript dán đoạn code sau vào khung code và save lại.<style scoped="" type="text/css">
ul.blogduykhanh_recent{list-style:none;margin:0;padding:0;}
.blogduykhanh_recent li{background:transparent;margin:0 0 6px!important;padding:3px
!important;display:block;clear:both;overflow:hidden;list-style:none; border: 1px solid transparent;
border-radius:9px; max-height: 100px;}
.blogduykhanh_recent li:hover{background:#fff;border: 1px solid #e9e9e9;}
.blogduykhanh_recent a {text-decoration:none;}
.avatarImage{padding:3px;background:#fefefe;float:left;margin:0 6px 0 0;position:relative;overflow:hidden;}
.avatarRound{border-radius:100px;width:35px;height:35px}
.blogduykhanh_recent li span{margin-top:4px;color: #444;display: block;font-size: 12px;line-height: 1.4;}
</style>
<script type="text/javascript">
//<![CDATA[
    var
 numComments  = 5,
 showAvatar  = true,
 avatarSize  = 35,
 roundAvatar = true,
 characters  = 40,
 defaultAvatar  = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjea3nkPJbntJKPhzQgtUnQvQpylra0wCFfdNOV7NJdcbIDwQsqQaobdIW_DMIWKXh4Ws_mLJFv1Pmjwyj91fHe7AAOEIZGbaINBWqUw8oGf-Laa4PMkYQhgaUv9WvgQEv1RFtrE54rX70/s1600/avatar-blogduykhanh.png",

 hideCredits = true;
 maxfeeds=50,
 adminBlog='BLOGDUYKHANH';
//]]>
</script>
<script src="https://googledrive.com/host/0B5VqGSVMkE9IWXM3VUlfRldQbUE/" type="text/javascript"></script>
<script src="/feeds/comments/default?alt=json&amp;callback=blogduykhanh_recent&amp;&amp;max-results=50" type="text/javascript">
</script>
Trong đoạn code trên bạn chú ý đoạn code màu đỏ, đó chính là những thông số của widget có thể thay đổi được.
  1. numComments  = 5,   Số comment được hiển thị
  2. showAvatar  = true, Hiển thị avatar comment hay không, nếu không muốn hiển thị bạn có thể sửa "true" thành "false"
  3. avatarSize  = 35,   Kích thước avatar hiển thị
  4. roundAvatar = true, Có bo góc hình tròn avatar hay không, nếu không muốn bo góc bạn có thể sửa "true" thành "false"
  5. characters  = 40,   Số ký tự nội dung comment hiển thị
  6. defaultAvatar  = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjea3nkPJbntJKPhzQgtUnQvQpylra0wCFfdNOV7NJdcbIDwQsqQaobdIW_DMIWKXh4Ws_mLJFv1Pmjwyj91fHe7AAOEIZGbaINBWqUw8oGf-Laa4PMkYQhgaUv9WvgQEv1RFtrE54rX70/s1600/avatar-blogduykhanh.png",  Avatar mặc định cho những người bình luận ẩn danh
Xong xuôi thì lưu lại và thưởng thức thôi. Chúc một ngày tốt lành! :D ,

Không có nhận xét nào:

Đăng nhận xét