Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schne324/modal
basic replacement of old-school prompt popup
https://github.com/schne324/modal
Last synced: about 2 months ago
JSON representation
basic replacement of old-school prompt popup
- Host: GitHub
- URL: https://github.com/schne324/modal
- Owner: schne324
- Created: 2013-06-06T18:17:43.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-11T16:06:06.000Z (over 11 years ago)
- Last Synced: 2024-04-24T10:24:49.230Z (9 months ago)
- Language: JavaScript
- Size: 243 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# modal
Very basic modal used to replace prompt. No animation, no jQuery...
## Installation
$ component install schne324/modal
## API
### Options:
@param {string}
[id]: Selector for the desired modal ID (default: 'modal')
[header]: Desired content for the modal header (default: 'Prompt Box!')
[close]: Desired content for the close button (default: 'X')
[ariaLabelClose]: Desired aria-label for the close button (default: 'close')
[modalContent]: Desired modal content (default: 'This is just like a prompt only it\'s not from the 70s')
[inputPlaceholder]: The desired placeholder in the input (default: 'Enter a value...')
[confirm]: Desired content for the submit/confirm button (default: 'Submit')
[cancel]: Desired content for the cancel/dismiss button (default: 'Cancel')
@param {element}
[insertInto]: Element in which the modal is inserted (default: document.body)## Example Usage
```javascript
var prompter = require('modal');
//////////////OPTIONS/////////////////
//note: not all options must be specified, there are fall-back defualts
var modal = prompter('#modal-trigger', {
id: 'my-modal',
header: 'Headache!',
close: '(X)',
modalContent: 'I am the egg man, I am the catephant',
inputPlaceholder: 'Hold my place...',
confirm: 'Okay',
cancel: 'Nope'
});modal.on('cancel', function () {
alert('you have clicked cancel, now all of your files are belong to us!');
});modal.on('confirm', function (res) {
alert('you hit confirm and said ' + res);
});```
## License
MIT