0.1.0 • Published 8 years ago

tsu.js v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Tsu.js

Build Status XO code style npm version

Just a notification in Vanilla

Install

npm i -S tsu.js

Usage

in CommonJS

const Tsu = require('tsu.js');

in ES6

import Tsu from 'tsu.js';

in Browsers

<script src="tsu.js"></script>

Example

<!DOCTYPE html>
<html>
<body>
  <button id="success">success</button>
  <button id="danger">danger</button>
  <script src="path/to/tsu.js"></script>
  <script>
    var success = new Tsu('success', {color: '#5cb85c'});
    var danger = new Tsu('danger', {color: '#d9534f'});
    document.getElementById('success').addEventListener('click', function() {
      success.add('Good');
    });
    document.getElementById('danger').addEventListener('click', function() {
      danger.add('Woops');
    });
  </script>
</body>
</html>

Tsu.js example

Options

Global

  • Tus.config.width
    Element width. By default 15em
  • Tsu.config.duration
    Sec until to fadeIn/Out. By default .2s
  • Tsu.config.timeout
    Sec until element is hidden. By default 2s
    Disabled by setting the null
  • Tsu.config.clickEvent
    ...
  • Tsu.config.position
    left, center, right
  • Tsu.config.maxSize
    Max notification length. By default 3

Instance

  • color
    Background color. By default #fff
  • label Whatever to display the .tsu__label. By default true