Skip to content

geidsonc/dialogs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dialogs

Dialogs for web and mobile

Dependency

jQuery

Usage

Simple and beautiful.

Install

Using bower

bower install geidsonbc/dialogs --save

or npm

npm install dialogsjs

or yarn

yarn add dialogsjs

Setup

Include:

<script src="{your-url}/dialogs.min.js" charset="utf-8"></script>
<link rel="stylesheet" href="{your-url}/dialogs.min.css">

Methods

  1. dialog.waiting('Message');

  2. dialog.confirm('Title', 'Message', function(){ // confirm }, function(){ // cancel });

  3. dialog.prompt('Title', 'Message', 'Label', 'Selector', function(){ // done }, function(){ // cancel });

  4. dialog.modal('Title', 'Message', function(){ ... });

  5. dialog.info('Title', 'Message', function(){ ... });

  6. dialog.help('Title', 'Message', { class: ..., func: ... });

  7. dialog.menu('Title', [{ value: ..., label: ... }, ... ], function(e){ ... } );

  8. dialog.close('Type');

Examples

  1. Info
dialog.info('Titulo', 'Corpo', function() {
	alert('callback');
});
  1. Confirm
dialog.confirm({
	title: 'Titulo',
	message: 'Corpo',
	confirm: {
		label: 'SIM',
		event: function() {
			alert('callback');
		}
	},
	cancel: {
		label: 'NÃO',
		event: function() {
			alert('callback');
		}
	}
});
  1. Menu
dialog.menu('Title', 
	[
		{
			value: '1',
			label: 'Opção 1'
		},

		{
			value: '2',
			label: 'Opção 2'
		}
	], 

	function (e) {
		var value = $(e.currentTarget).data('value');

		alert("Callback ao clicar na opção de valor " + value);
	}
);

Contributing

  1. Fork it!
  2. Create a new branch
  3. Commit your changes
  4. Push to the branch
  5. Submit a pull request :D

License

Licensed under the MIT License.