Home  >  Article  >  Web Front-end  >  cnblogs TagCloud implementation code based on jquery_jquery

cnblogs TagCloud implementation code based on jquery_jquery

WBOY
WBOYOriginal
2016-05-16 18:25:10925browse

1. Enter the "Management>> Configuration" panel

2. In the "Customize page style through CSS" text box, add:

Copy Code The code is as follows:

/***********tag cloud css****************/
#tagCloud {
text-align:center;
overflow: hidden;
}
#tagCloud a{
padding: 0 5px;
line-height:1.5em;
display:inline-block;
}


3. In the "Footer Html Code" text box, add:
Copy the code The code is as follows:

<script> <br>/***********tag cloud script****************/ <br>if($("#taglist").length>0) <br>{ <br>var dict = {}; <br>$("#taglist td").has("a").has("span").each(function(i, x){ <br>dict[$("a", this).text()] = $("span", this).text().replace(/[)(]/g, ""); <br>}); <br>$("<div&gt ;").attr("id", "tagCloud").appendTo("div#mainContent"); <BR>for(var k in dict) <BR>{ <BR>var sz = (dict[k] * 4) 12; <BR>$("<a>") <br>.attr("href", "http://www.cnblogs.com/k-sharp/tag/" escape(k) "/ ") <br>.attr("title", dict[k]) <br>.css("font-size", sz "px") <br>.text(k) <br>.appendTo("# tagCloud"); <br>} <br>$("#taglist").remove(); <br>} <br></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn