jqcloud 是jQuery的一个插件,用于生成标签云。
github地址:https://github.com/lucaong/jQCloud
用法
1.确保引入jQuery
2.引入js和css
<link href="//cdn.bootcss.com/jqcloud/1.0.4/jqcloud.min.css" rel="stylesheet">
<script src="//cdn.bootcss.com/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script>
3.在需要显示的地方写一个空的DIV
<div id="cloud"></div>
4.JS
生成方法为$("#cloud").jQCloud(array)
其中array为形式如下的数组,其中text
为要显示的标签的文字,weight
为权重。weight
可以是任意数字,此插件会根据权重确定字的大小及颜色。
var array = [
{text: "标签1", weight: 13},
{text: "标签2", weight: 10.5},
{text: "日常", weight: 9.4}
];
参数列表
参数 | 默认值 | 作用 |
---|