多彩标签看着更炫酷,下面看看本站的侧边效果吧!

zblogphp侧边多彩标签设置方法

是不是比原来的黑色的没有色彩的好看多了?设置方法走起!

第一步:zblog后台模块管理在相对应侧边添加标签;

第二步:在模板内添加JS代码给标签定义class属性;

<!--多彩标签--><script>$(document).ready(function() { 
    var tags_a = $("#divTags a"); 
    tags_a.each(function(){ 
        var x = 9; 
        var y = 0; 
        var rand = parseInt(Math.random() * (x - y + 1) + y); 
        $(this).addClass("tags"+rand); 
    }); }) </script><!--多彩标签-->

第三步:在模板CSS文件添加颜色浮动;

#divTags .tags0 {
    background-color: #efac82;}#divTags .tags1 {
    background-color: #84c7cf;}#divTags .tags2 {
    background-color: #d69899;}#divTags .tags3 {
    background-color: #d59ad4;}#divTags .tags4 {
    background-color: #c9b070;}#divTags .tags5 {
    background-color: #475042b3;}#divTags .tags6 {
    background-color: #ff716a;}#divTags .tags7 {
    background-color: #4a64e2;}#divTags .tags8 {
    background-color: #62b360;}#divTags .tags9 {
    background-color: #ff7aa5;}

第四步:进入网站后台 - 主题管理 - 启用主题就可以了。