Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ $('.modal .close').on('click', function(e){

// open modal with default options or options set with init
// content will be taken from #login
$('#terms-of-service').modal().open();
$('#terms-of-service').themodal().open();

// also we can open modal overriding some default options
$('#terms-of-service').modal().open({
$('#terms-of-service').themodal().open({
closeOnESC: false
});

// Close modal. There's no need to choose which one since only one can be opened
$.modal().close();
$.themodal().close();
```

### Custom content

```javascript
$.modal().open({
$.themodal().open({
onOpen: function(el, options){
el.html('Hello!');
}
Expand All @@ -81,7 +81,7 @@ $.modal().open({
### AJAX-content

```javascript
$.modal().open({
$.themodal().open({
onOpen: function(el, options){
$.get('http://example.com/', function(data){
el.html(data);
Expand All @@ -93,7 +93,7 @@ $.modal().open({
### Available options (default values)

```javascript
$.modal({
$.themodal({
/* css class of locked container(body) */
lockClass: 'themodal-lock',

Expand Down Expand Up @@ -125,12 +125,12 @@ $.modal({

```javascript
// set option as default for all modals opened
$.modal({
$.themodal({
closeOnESC: true
});

// set some default options for specific dom element
$('#login').modal({
$('#login').themodal({
closeOnESC: true,
onClose: function(el, options) {
alert('Closed!');
Expand Down
10 changes: 5 additions & 5 deletions jquery.the-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@

// close modal if opened
if($('.'+localOptions.overlayClass).length) {
$.modal().close();
$.themodal().close();
}

var overlay = $('<div/>').addClass(localOptions.overlayClass).prependTo('body');
Expand All @@ -166,7 +166,7 @@
if(localOptions.closeOnEsc) {
$(document).bind('keyup.'+pluginNamespace, function(e){
if(e.keyCode === 27) {
$.modal().close();
$.themodal().close();
}
});
}
Expand All @@ -176,7 +176,7 @@
e.stopPropagation();
});
$('.' + localOptions.overlayClass).on('click.' + pluginNamespace, function(e){
$.modal().close();
$.themodal().close();
});
}

Expand Down Expand Up @@ -245,11 +245,11 @@
};
}

$.modal = function(options){
$.themodal = function(options){
return init($(), options);
};

$.fn.modal = function(options) {
$.fn.themodal = function(options) {
return init(this, options);
};

Expand Down