Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/segment-boneyard/overlay
A simple overlay UI component.
https://github.com/segment-boneyard/overlay
Last synced: about 7 hours ago
JSON representation
A simple overlay UI component.
- Host: GitHub
- URL: https://github.com/segment-boneyard/overlay
- Owner: segment-boneyard
- Created: 2013-08-21T18:40:48.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-06T20:11:50.000Z (almost 10 years ago)
- Last Synced: 2024-04-09T16:31:13.399Z (7 months ago)
- Language: JavaScript
- Size: 252 KB
- Stars: 7
- Watchers: 44
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# overlay
A simple overlay UI component.
## Installation
$ component install segmentio/overlay
## Example
```js
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`](https://github.com/component/emitter) is mixed in.### #classes
[`ianstormtaylor/classes`](https://github.com/ianstormtaylor/classes) is mixed in.
## License
MIT