Skip to content

segment-boneyard/overlay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

overlay

A simple overlay UI component.

Installation

$ component install segmentio/overlay

Example

var overlay = require('overlay');

overlay().closeable(); // the body now has an overlay on it

API

overlay(target)

Show an overlay on a given target element, defaulting to document.body.

#show(fn)

Show the overlay, optionally calling a callback fn. Emits showing and show.

#hide(fn)

Hide the overlay, optionally calling a callback fn. Emits hiding and hide.

#remove(fn)

Remove the overlay from the DOM optionally calling a callback fn. If the overlay isn't hidden yet, hide it first. Emits removing and remove.

#closeable()

Make the overlay closeable by clicking on it, or hitting the ESC key. Aliased to closable for convenience.

#temporary()

Make the overlay remove itself after it's been hidden. This is useful for one-off overlays where you don't want to have to manage removing it from the DOM.

#emitter

component/emitter is mixed in.

#classes

ianstormtaylor/classes is mixed in.

License

MIT