如果你想在博客侧栏添加一个标签云模块,那么不妨试下这款jQuery多彩标签云吧!
jQuery多彩标签云代码不仅支持字体样式随机并且还支持支持F5随机刷新;
html代码
<div class="demo"> <h2>jQuery 标签云 <span style="color:#3366cc;">F5刷新试试</span></h2> <div class="taglist" id="tags"> <a target="_blank" href="https://www.fengyan.cc/">zblog博客主题</a> <a target="_blank" href="https://www.fengyan.cc/">zblog教程</a> <a target="_blank" href="https://www.fengyan.cc/">添加404页面</a> <a target="_blank" href="https://www.fengyan.cc/">网站优化</a> <a target="_blank" href="https://www.fengyan.cc/">zblog入门</a> <a target="_blank" href="https://www.fengyan.cc/">博客主题</a> <a target="_blank" href="https://www.fengyan.cc/">资源分享</a> <a target="_blank" href="https://www.fengyan.cc/">CMS主题</a> <a target="_blank" href="https://www.fengyan.cc/">免费主题</a> <a target="_blank" href="https://www.fengyan.cc/">加载动画</a> <a target="_blank" href="https://www.fengyan.cc/">返回顶部</a> <a target="_blank" href="https://www.fengyan.cc/">建站准备</a> <a target="_blank" href="https://www.fengyan.cc/">注册域名</a> <a target="_blank" href="https://www.fengyan.cc/">wordpress优化</a> <a target="_blank" href="https://www.fengyan.cc/">挂载磁盘</a> <a target="_blank" href="https://www.fengyan.cc/">本地php环境</a> <a target="_blank" href="https://www.fengyan.cc/">烽烟博客</a> </div> </div>
CSS代码
*{margin:0;padding:0;list-style-type:none;} a{margin:0;padding:0;background:transparent;color:#666;vertical-align:baseline;text-decoration:none;font-size:100%;font-family:"Open Sans","Hiragino Sans GB","Microsoft YaHei","WenQuanYi Micro Hei",Arial,Verdana,Tahoma,sans-serif;} a:hover,a:focus{color:#FF6B57;text-decoration:none;cursor:pointer;} body{font:12px/180% Arial, Helvetica, sans-serif ,"宋体";} .demo{background:#FFF8DE;border:solid 1px #ff6600;width:380px;margin:20px auto;} .demo h2{font-size:18px;height:32px;padding:10px 0 0 20px;font-family:"微软雅黑","宋体";border-bottom:solid 1px #ff6600;} .taglist{padding:20px 20px 30px 20px;} .taglist a{padding:3px;display:inline-block;white-space:nowrap;} a.size1{font-size:25px;padding:10px;color:#804D40;} a.size1:hover{color:#E13728;} a.size2{padding:7px;font-size:20px;color:#B9251A;} a.size2:hover{color:#E13728;} a.size3{padding:5px;font-size:35px;color:#C4876A;} a.size3:hover{color:#E13728;} a.size4{padding:5px;font-size:15px;color:#B46A47;} a.size4:hover{color:#E13728;} a.size5{padding:5px;font-size:25px;color:#E13728;} a.size5:hover{color:#B46A47;} a.size6{padding:0px;font-size:12px;color:#77625E} a.size6:hover{color:#E13728;}
js代码
$(document).ready(function(){ var tags_a = $("#tags").find("a"); tags_a.each(function(){ var x = 9; var y = 0; var rand = parseInt(Math.random() * (x - y + 1) + y); $(this).addClass("size"+rand); }); });