之前论坛有人发过这个教程,现在我把改良美化过后的代码发出来。使用方法:index.html 模板 例如 div class=pright 后面加入 (位置随你) 复制代码 …
之前论坛有人发过这个教程,现在我把改良美化过后的代码发出来。
使用方法:
index.html 模板 例如 <div class="pright"> 后面加入 (位置随你)
- <div id="tagCloud" class="hot mt1">
- <dl class="tbox light">
- <dt class=’light’><strong>热点标签Tags</strong></dt>
- <dd class=’light’>
- {dede:tag sort=’rand’ row=’40′ getall=’1′}<a href=’[field:link/]‘>[field:tag /]</a>{/dede:tag}
- </dd>
- </dl>
- </div>
|
css
- #tagCloud a{
- text-decoration:none;
- padding:3px;
- }
- #tagCloud a:hover{
- background:#69f;
- color:#fff;
- }
- .color0{
- color:#76B504;
- }
- .color1{
- color:#AC1BF2;
- }
- .color2{
- color:#9E6FC5;
- }
- .color3{
- color:#FBA426;
- }
- .color4{
- color:#CAC83B;
- }
- .color5{
- color:#C8A453;
- }
- .color6{
- color:#AB2846;
- }
- .weight0{
- font-weight:100;
- }
- .weight1{
- font-weight:300;
- }
- .weight2{
- font-weight:500;
- }
- .weight3{
- font-weight:700;
- }
- .weight4{
- font-weight:900;
- }
- .weight5{
- font-weight:bold;
- }
- .weight6{
- font-weight:bolder;
- }
- .size0{
- font-size:12px;
- }
- .size1{
- font-size:13px;
- }
- .size2{
- font-size:14px;
- }
- .size3{
- font-size:15px;
- }
- .size4{
- font-size:16px;
- }
- .size5{
- font-size:17px;
- }
- .size6{
- font-size:18px;
- }
|
js代码(2个js代码一样,任选一个,第一个为压缩过的,可以提升页面加载速度,第二个为普通未压缩),建议放到模板最后
- <script language="javascript" type="text/javascript">
- eval(function(p, a, c, k, e, d) { e = function(c) { return (c < a ? ” : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!”.replace(/^/, String)) { while (c–) { d[e(c)] = k[c] || e(c) } k = [function(e) { return d[e] } ]; e = function() { return ‘\w+’ }; c = 1 }; while (c–) { if (k[c]) { p = p.replace(new RegExp(‘\b’ + e(c) + ‘\b’, ‘g’), k[c]) } } return p } (‘G d(){1 4=9 b("E","K","x","w","v","y","u");1 5=9 b("B","A","C","n","p","o","t");1 6=9 b("r","z","S","N","M","O","D");1 k=4.3;1 l=5.3;1 m=6.3;1 8=h.P("8");1 7=8.Q("a");1 j=7.3;F(i=0;i<j;i++){7[i].H=4[2.c(k*2.e())]+" "+5[2.c(l*2.e())]+" "+6[2.c(m*2.e())]}}J(h.g){f.g(‘R’,d,s)}q{f.I(‘L’,d)}’, 55, 55, ‘|var|Math|length|colors|sizes|weights|tagLinks|tagCloud|new||Array|floor|setTagCloudStyle|random|window|addEventListener|document||tagLinksLen|colorsLen|sizesLen|weightsLen|size3|size5|size4|else|weight0|false|size6|color6|color4|color3|color2|color5|weight1|size1|size0|size2|weight6|color0|for|function|className|attachEvent|if|color1|onload|weight4|weight3|weight5|getElementById|getElementsByTagName|load|weight2′.split(‘|’), 0, {}))
- </script>
|
- function setTagCloudStyle() {
- var colors = new Array("color0", "color1", "color2", "color3", "color4", "color5", "color6");
- var sizes = new Array("size0", "size1", "size2", "size3", "size4", "size5", "size6");
- var weights = new Array("weight0", "weight1", "weight2", "weight3", "weight4", "weight5", "weight6");
- var colorsLen = colors.length;
- var sizesLen = sizes.length;
- var weightsLen = weights.length;
- var tagCloud = document.getElementById("tagCloud");
- var tagLinks = tagCloud.getElementsByTagName("a");
- var tagLinksLen = tagLinks.length;
- for (i = 0; i < tagLinksLen; i++) {
- tagLinks[i].className = colors[Math.floor(colorsLen * Math.random())] + " " + sizes[Math.floor(sizesLen * Math.random())] + " " + weights[Math.floor(weightsLen * Math.random())]
-
- }
-
- }
- if (document.addEventListener) {
- window.addEventListener(‘load’, setTagCloudStyle, false)
-
- } else {
- window.attachEvent(‘onload’, setTagCloudStyle)
-
- }
|
css代码中 size 字体大小,color 颜色,weight 字体粗细
这些0-6是js随机读出的,想要什么颜色都可以自定义,自己找个颜色截取器弄,不过我都弄得很大众化了,没事不需要改
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!