1.0.2 • Published 10 years ago

tip-component v1.0.2

Weekly downloads
79
License
-
Repository
github
Last release
10 years ago

Tip

Tip component. Inspired by tipsy without the weird jQuery API.

js tip component js tip with markup

js maru

Live demo is here.

Installation

$ npm install tip-component

Features

  • events for composition
  • "auto" positioning on window resize / scroll
  • fluent API

Events

  • show the tip is shown
  • hide the tip is hidden

API

Tip(el, string)

Equivalent to Tip(el, { value: string }).

Tip(el, options)

Attach a Tip to an element, and display the title attribute's contents on hover. Optionally apply a hide delay in milliseconds.

var tip = require('tip');
tip('a[title]', { delay: 300 });

new Tip(content)

Create a new tip with content being either a string, html, element, etc.

var Tip = require('tip');
var tip = new Tip('Hello!');
tip.show('#mylink');

Tip#position(type, options)

  • top
  • top right
  • top left
  • bottom
  • bottom right
  • bottom left
  • right
  • left

Options:

  • auto set to false to disable auto-positioning

Tip#show(el)

Show the tip attached to el, where el may be a selector or element.

Tip#show(x, y)

Show the tip at the absolute position (x, y).

Tip#hide(ms)

Hide the tip immediately or wait ms.

Tip#attach(el)

Attach the tip to the given el, showing on mouseover and hiding on mouseout.

Tip#effect(name)

Use effect name. Default with Tip.effect = 'fade' for example.

Themes

License

MIT

1.0.2

10 years ago

1.0.1

10 years ago

1.0.3

10 years ago

1.0.0

10 years ago

0.3.0

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago