项目作者: Knovour

项目描述 :
Let user name become a simple text avatar
高级语言: JavaScript
项目地址: git://github.com/Knovour/jquery-textavatar.git
创建时间: 2013-11-17T12:11:37Z
项目社区:https://github.com/Knovour/jquery-textavatar

开源协议:MIT License

下载


jQuery Text Avatar (include vanillajs version)

Let user name become a simple text avatar

Demo

Usage

For older version check here

  1. npm i jquery.textavatar

Load textavatar.css or just merge to your css file.

jQuery

  1. <div class='textavatar' style='width: 140px;' data-name='NAME INSIDE'></div>
  2. <script src="jquery.textavatar.js"></script>
  1. $('.textavatar').textAvatar()

Auto Create

  1. <div class='textavatar' style='width: 140px;' data-name="NAME INSIDE" data-toggle="textavatar"></div>

Options

There is only width and name now.

  1. $('DIV-NAME').textAvatar({
  2. width: 120, //no need to type 'px'
  3. name: NAME HERE
  4. })

VanillaJS

  1. <div class='textavatar' style='width: 140px;' data-name='NAME INSIDE'></div>

For es6 module

  1. import textAvatar from 'textavatar.js'
  2. textAvatar(document.querySelector('.textavatar'))

For normal usage

  1. <script src="textavatar.iife.js"></script>

Auto Create

  1. <div class='textavatar' style='width: 140px;' data-name="NAME INSIDE" data-toggle="textavatar"></div>

Options

There is only width and name now.

  1. textAvatar(document.querySelector('DIV-NAME'), {
  2. width: 120, //no need to type 'px'
  3. name: NAME HERE
  4. })

MIT License