Lần này mình giới thiệu một mẫu most comments khác, có thể chỉnh sửa màu sắc dễ dàng theo ý thích kết hợp hiệu ứng nữa trông rất đẹp.
2. > Mẫu > Chỉnh sửa HTML > Tìm thẻ </group> hoặc <b:skin><![CDATA[
3. > Dán code dưới vào dưới thẻ vừa tìm được
#Thêm Group
1. Đăng nhập Blogger2. > Mẫu > Chỉnh sửa HTML > Tìm thẻ </group> hoặc <b:skin><![CDATA[
3. > Dán code dưới vào dưới thẻ vừa tìm được
<Group description="Most Commented" selector=".most-commented"> <Variable name="most.commented.background1" description="background color1" type="color" default="#fa4242" value="#ee377a"/> <Variable name="most.commented.background2" description="background color2" type="color" default="#ee6107" value="#fcad37"/> <Variable name="most.commented.background3" description="background color3" type="color" default="#f0f" value="#f8e000"/> <Variable name="most.commented.background4" description="background color4" type="color" default="#ff0" value="#c7e93d"/> <Variable name="most.commented.background5" description="background color5" type="color" default="#0ff" value="#5ebded"/> </Group>
#Thêm CSS
1. > Tìm thẻ ]]></b:skin>
2. > Dán code dưới vào trên thẻ vừa tìm được
.comment-count {
padding: 3px 10px;
background: #fff;
color: #000;
font-size: 10px;
float: right;
}
.most-commented ul {
padding: 0px !important;
font-family: Century Gothic, sans-serif;
}
.most-commented ul li {
list-style-type: none;
padding: 10px;
color: #555;
margin-top: -10px;
}
.most-commented ul li a {
color: #444;
font-weight: bold;
text-decoration: none;
font-size: 11px;
}
.most-commented ul li img {
float: left;
margin: 0px 5px 0px 0px;
width: 60px;
height: 60px;
}
.most-commented:nth-child(3n+0) {
background: $(most.commented.background1);
width: 100%;
}
.most-commented:nth-child(4n+0) {
background: $(most.commented.background2);
width: 95%;
}
.most-commented:nth-child(5n+0) {
background: $(most.commented.background3);
width: 90%;
}
.most-commented:nth-child(6n+0) {
background: $(most.commented.background4);
width: 85%;
}
.most-commented:nth-child(7n+0) {
background: $(most.commented.background5);
width: 80%;
}
#Thêm Scrip
1. > Bố cục > Thêm tiện ích > HTML/Javascrip
2. > Dán code dưới vào và save lại
<script type="text/javascript">
function stripTags(s,n) {
return s.replace(/<.*?>/ig,"").split(/\s+/).slice(0,n-1).join(" ")
}
function mostcommented(feed) {
var i;
for (i = 0; i < feed.count ; i++) {
var postURL = "'" + feed.value.items[i].link + "'";
var postTitle = feed.value.items[i].title;
var postthumbnail = "<img src="+feed.value.items[i].postthumbnail+" />";
var postDescription = feed.value.items[i].postdescription;
var postComments = feed.value.items[i].commentcount;
var postList = '<div class="most-commented"><ul><li><div class="comment-count">' + postComments + "</div>" + postthumbnail + "<a href="+ postURL + '">' + postTitle + "</a>" + '<p>' +stripTags(postDescription,10)+'...</p>' + '</li></ul></div>';
document.write(postList);
}
}
</script>
<script src="http://pipes.yahoo.com/pipes/pipe.run?
AddUrlHere=http://khanh98.blogspot.com.blogspot.com
&NumberofPosts=5
&_id=2cb5eb603ed55a6264ee1484e5fdd45c
&_callback=mostcommented
&_render=json"
type="text/javascript"></script><span style="font-size: 80%; float:left;"><a href="http://helplogger.blogspot.com/2014/08/most-commented-posts-blogger-widget.html">Add this widget</a></span>
Hoặc nếu bạn muốn style đơn giản thì là code
<script type="text/javascript">
function stripTags(s,n)
{
return s.replace(/<.*?>/ig,"").split(/\s+/).slice(0,n-1).join(" ")
}
function mostcommented(feed) {
var i;
for (i = 0; i < feed.count ; i++)
{
var postURL = "'" + feed.value.items[i].link + "'";
var postTitle = feed.value.items[i].title;
var postComments = feed.value.items[i].commentcount;
var postList = '<div class="most-commented"><ul><li style="margin-bottom: 10px"><div class="comment-count">' + postComments + "</div>" + "<a href="+ postURL + '">' + postTitle + "</a>" + '</li></ul></div>';
document.write(postList);
}
}
</script>
<script src="http://pipes.yahoo.com/pipes/pipe.run?
AddUrlHere=http:khanh98.blogspot.com
&NumberofPosts=5
&_id=2cb5eb603ed55a6264ee1484e5fdd45c
&_callback=mostcommented
&_render=json"
type="text/javascript"></script>
<span style="font-size: 80%; float:left;"><a href="http://helplogger.blogspot.com/2014/08/most-commented-posts-blogger-widget.html">Add this widget</a></span>
Lưu ý:
Thay liên kết khanh98.blogspot.com thành liên kết tới blog của bạn
Thay đoạn màu xanh thành code dưới nếu bạn muốn có thêm phần trích dẫn.
<div class="comment-count">' + postComments + " comments" + "</div>"
#Tùy chỉnh màu sắc
1. > Bố cục > Trình thiết kế mẫu, nó nằm trên phần bố cục nha
2. > Nâng cao > Most commented
3. > Chỉnh màu từng ô theo ý thích



Comments
Post a Comment
» Vui lòng không spam vì nó sẽ bị xóa ngay sau đó.
» Nếu chèn code hãy mã hóa trước khi chèn vào nhận xét.
» Nếu thủ thuật Blog không áp dụng được thì hãy để lại URL blog để mình tiện kiểm tra.