我的文档
mnew主题添加彩色标签云
把以下代码添加到当前主题中的style.css文件:
- /*彩色标签*/
- .tagcloud{
- padding:14px 0 14px 12px;
- }
- .tagcloud a{
- float:left;
- margin:3px;
- line-height:26px;
- text-align:center;
- border:1px solid #ddd;
- border-radius:2px;
- padding-top:0;
- padding-right:5px;
- padding-bottom:0;
- padding-left:5px;
- overflow:hidden;
- display:block;
- width:92px;
- height:28px;
- }
- .tagcloud a{
- color:#fff;
- }
js代码:
把以下代码放置到head.php或footer.php
- <script type="text/javascript">box_width = $("#cx_tag_cloud-5").width();
- /*彩色标签*/
- len = $(".tagcloud a").length - 1;
- $(".tagcloud a").each(function(i) {
- var let = new Array('3366FF', '31ac76', 'ea4563', '31a6a0', '8e7daa', '4fad7b', 'f99f13', 'f85200', '666666');
- var random1 = Math.floor(Math.random() * 9) + 0;
- var num = Math.floor(Math.random() * 6 + 9);
- $(this).attr('style', 'background:#' + let[random1] + '');
- if ($(this).next().length > 0) {
- last = $(this).next().position().left
- }
- });</script>