jquery - 如何使用CSS在无序列表中格式化随机子项

标签 jquery css

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 6 年前

how to format random items in an un-ordered list using CSS or JS as shown in the picture enter image description here

最佳答案

看看这个:https://jsfiddle.net/er0j1fv4/

<html>

<head> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script> 
</head> 

<body> 

    <div id="div1" style="width: 600px; height: 400px;"></div>


    <script>

  $(document).ready(function(){

      var wordList = [
          {text: "Peter", weight: 15},
          {text: "Martin", weight: 9, link: "http://www.google.com/"},
          {text: "Manhattan", weight: 6, html: {title: "This is the manhattan city"}},
          {text: "Amalie", weight: 7},
          {text: "Himalayas", weight: 5},
          {text: "Peter", weight: 15},
          {text: "Martin", weight: 9, link: "http://www.google.com/"},
          {text: "Manhattan", weight: 6, html: {title: "This is the manhattan city"}},
          {text: "Amalie", weight: 7},
          {text: "Himalayas", weight: 5},
          {text: "Peter", weight: 15},
          {text: "Martin", weight: 9, link: "http://www.google.com/"},
          {text: "Manhattan", weight: 6, html: {title: "This is the manhattan city"}},
          {text: "Amalie", weight: 7},
          {text: "Himalayas", weight: 5},
      ];

        $("#div1").jQCloud(wordList);

  });

    </script>

</body> 

</html> 

结果:

enter image description here

引用:

https://github.com/lucaong/jQCloud

关于jquery - 如何使用CSS在无序列表中格式化随机子项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41054064/

上一篇:css - 在我的容器中居中登录网格?

下一篇:html - 无法将导航丸的默认背景颜色从蓝色更改

相关文章:

html - apache中目录列表的自动样式

html - 如何将多个媒体目标(屏幕、打印)与宽度限制相结合?

html - 为什么div不会在上面的div下面向上滑动?

javascript - 如何在 IE 中查看 JavaScript/JQuery 代码的错误消息?

php - 使用 Jquery 和 PHP 在 POST Ajax 后返回(一个空字符串)

javascript - 检查嵌入项目中 div 的值

php - 数据没有从ajax发送到php

html - 据我所知这是可能的,我将从哪里开始?

javascript - 如何在用户单击正文时隐藏 div

javascript - 鼠标移动/滚动到下一个哈希