Tag cloud plugin for jQuery, showing bigger tags in the center

Overview

jquery.tagcloud v1.2.0

Tag cloud plugin for jQuery, showing bigger tags in the center.

Sample screenshot

Usage

There are two ways to define a tag cloud:

  1. Use ul and li HTML tags
  2. Use a configuration object and a div HTML tag

1. Use ul and li HTML tags

<script src="https://code.jquery.com/jquery-latest.js" type="text/javascript" charset="utf-8"></script>
<script src="/path/to/jquery.tagcloud.js" type="text/javascript" charset="utf-8"></script>

<ul id="tagCloud1">
  <li data-weight="60"><a href="#">HTML</a></li> <!-- with link -->
  <li data-weight="65">CSS</li> <!-- without link -->
  <li data-weight="85">JavaScript</li>
  <!-- etc... -->
</ul>

<script>
$(document).ready(function() {
  $('#tagCloud1').tagCloud();
});
</script>

Add a data-weight attribute to the li tag or the a tag to indicate the weight. The weight determins the size of the font used in the tag cloud.

Customize the tag cloud with a configuration object, see configuration.

2. Use a configuration object and a div HTML tag

<div id="tagCloud2"></div>

<script>
$(document).ready(function() {
  $('#tagCloud2').tagCloud({
    data: [
      { tag: 'HTML',       weight: 60 },
      { tag: 'CSS',        weight: 65,
        link: 'https://en.wikipedia.org/wiki/CSS'
        tooltip: 'Cascading Style Sheets' },
      { tag: 'JavaScript', weight: 85 },
      // etc...
    ]
  });
});
</script>

Add a data key to the configuration object containing an array of objects, where each object has two required keys:

  • tag: Tag name
  • weight: Weight, determining the size of the font used in the tag cloud

See additional options in the configuration

Configuration

Pass a configuration object to .tagCloud():

{
  container: {  // all keys are optional, default as indicated
    width:            500,        // tag cloud width
    height:           'auto',     // tag cloud height
    padding:          '10px 5px', // padding
    backgroundColor:  '#f0f0f0'   // background color
    fontFamily:       '"Helvetica Neue",Helvetica,Arial,sans-serif', // font family
    // add additional styles as desired
  },
  tag: {        // all keys are optional, default as indicated
    margin:           '3px 7px',  // tag margin
    padding:          '3px 10px', // tag padding
    borderRadius:     '5px',      // border radius
    color:            'auto',     // automatic text color, black for light background,
                                  //   and white for dark background
    backgroundColor:  '#ff9655',  // background color,  default is one out of many
    minFontSize:      10,         // minimum font size in pixels
    maxFontSize:      45,         // maximum font size in pixels
    format:         '{tag.name}', // tag format, use HTML with tokens:
                                  //   {tag.name}: tag name
                                  //   {tag.link}: tag link
                                  //   {tag.weight}: weight
                                  //   {tag.weight.0}: rounded weight
                                  //   {tag.weight.2}: weight rounded to 2 decimal places
                                  //   {tag.percent}: percent weight to sum of all weights
                                  //   {tag.percent.1}: percentage rounded to 1 decimal
    textShadow:       false       // text shadow, enable for better visibility
  },
  data: [       // required if div tag is used
    {
      tag:             'GitHub',  // tag name, may include HTML, required
      link:            'https://github.com/', // link, optional
      tooltip:         'Message', // tooltip, optional
      weight:          60,        // tag weight, required
      color:           '#ffffff'  // text color, optional
      backgroundColor: '#db843d'  // background color, optional (short key: bgColor)
    },
    // etc...
  ]
}

The tag with the smallest weight will use the font defined by minFontSize, the one with the biggest weight will use maxFontSize.

Demo

See demo.html

You might also like...

Block Library Primitives by Pew Research Center

A starting point for anyone looking to add functionality, extra control to and or create your own custom block library using core/blocks. Built with easier extensibility in mind

Nov 5, 2022

Obsidian plugin that adds autocomplete and auto-formatting to frontmatter tags.

Obsidian plugin that adds autocomplete and auto-formatting to frontmatter tags.

Obsidian Front Matter Tag Wizard Tired of having to type # to get tag autocompletion in your Obsidian note front matter? I feel your pain. This plugin

Nov 5, 2022

A logseq plugin to extract tweets. Optionally tag the tweet's author as well.

A logseq plugin to extract tweets. Optionally tag the tweet's author as well.

Logseq Twitter Extractor Plugin If this plugin helps you, I'd really appreciate your support. You can buy me a coffee here. A quick utility to parse a

Nov 17, 2022

Linkify is a JavaScript plugin for finding links in plain-text and converting them to HTML a tags.

Linkify Linkify is a JavaScript plugin. Use Linkify to find links in plain-text and convert them to HTML a tags. It automatically highlights URLs, #

Dec 27, 2022

The Taste food web app is our JavaScript capstone project, Taste food is a web application based on an external food API, showing data about Italian foods and we used Used involvement API to record the different user interactions (likes, comments).

taste-food The Taste food web app is our JavaScript capstone project, Taste food is a web application based on an external food API TheMealDB, showing

Aug 10, 2022

This web application is a type of a scoreboard showing the names and current scores of the leading competitors in any field which is using API's to get and set data

This web application is a type of a scoreboard showing the names and current scores of the leading competitors in any field which is using API's to get and set data

Leaderboard-project This web application is a type of a scoreboard showing the names and current scores of the leading competitors in any field which

Feb 11, 2022

Sample apps showing how to build music and video apps for Xbox using a WebView.

Sample apps showing how to build music and video apps for Xbox using a WebView.

description languages name page_type products urlFragment Sample showing how to build music and video apps using primarily web technologies for Xbox.

Dec 14, 2022

Simple components showing differences in each major frontend web framework.

Web Frameworks A collection of simple components in each of the leading frontend web frameworks. So far, covering React, Vue, Angular, Svelte and Soli

Nov 27, 2022

Example application showing how to use single-table design with GraphQL and DynamoDB

GraphQL + DynamoDB -- Single-table example This repository includes an example of building a GraphQL API with DynamoDB using a single DynamoDB table.

Dec 13, 2022
Comments
  • Responsiveness

    Responsiveness

    Hello everybody!

    It would be great if the cloud of tags could be responsive, adjusting its size according to the available area space.

    Thanks in advance!

    opened by flaviorib-dev 0
Owner
Peter Thoeny
Peter Thoeny
It's an AI Tag (Prompt) generator for magic drawer! We have many tags and support to generate prompts easily!

魔导绪论 AI 魔咒生成器, 使用由 B 站 UP 主 十二今天也很可爱 提供的 4 万个 tag 并提供中文检索,并提供了魔咒社区方便魔法师们直接复制生成。永远免费,永无广告,无商业。 v2 版本更新内容 使用 Netlify 的云函数提供更为快速的社区数据操作!(暂时不知道花费多少) 查看自己的

江夏尧 28 Jan 1, 2023
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
jQuery plugin for showing a calendar yearview with blocks (github contributions style)

calendar-yearview-blocks jQuery plugin for showing a calendar yearview with blocks (github contributions style) Code adopted from https://github.com/b

Opbod 2 Feb 28, 2021
jQuery tags input plugin based on Twitter Bootstrap.

Bootstrap Tags Input Bootstrap Tags Input is a jQuery plugin providing a Twitter Bootstrap user interface for managing tags. Current stable version: v

null 26 Dec 21, 2022
This is a JQuery plugin for input tags with auto complete suggestion.

Jquery Suggestags This is a JQuery plugin for input tags with auto complete suggestion. $('input').amsifySuggestags(); npm installation npm i suggesta

Amsify42 60 Nov 16, 2022
Picky is a jQuery plugin that provides simple client-side date validation when entering dates using select tags.

jquery.picky.js Picky is a jQuery plugin that provides simple client-side date validation when entering dates using select tags. Features Instead of g

Patrick Crowley 5 Apr 25, 2021
You can detect requested client full IP details with this package. (isp, organization, location, residential/data center, proxy, etc)

requested client ip details Install the package npm npm install @sarequl/client-ip-details yarn yarn add @sarequl/client-ip-details example with expr

Sarequl Basar 8 Oct 13, 2022
Your center for health applications ❤️📝

❤️ Health Center Health Center is an app that puts you in one place to use health-related calculation tools! ?? Tech stack React create-react-app styl

Revku 6 Aug 24, 2022