Skip to content

Commit

Permalink
Add option function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nycto committed May 27, 2014
1 parent 82af3da commit 01cbb39
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ The following methods are available on the object returned by `picoModal`:
* __close__: Hides the modal
* __forceClose__: Hides the modal without calling the beforeClose events
* __destroy__: Detaches all DOM Nodes and unhooks this modal
* __options__: Updates the options for this modal. This will only let you
change options that are re-evaluted regularly, such as `overlayClose`.
* __afterCreate__: Registers a callback to invoke when the modal is created
* __beforeShow__: Registers a callback to invoke before the modal is shown
* __afterShow__: Registers a callback to invoke when the modal is shown
Expand Down
15 changes: 14 additions & 1 deletion src/picoModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@
opacity: 0.5,
background: "#000"
}))
.onClick( getOption('overlayClose', true) ? close : function(){} );
.onClick(function () {
if ( getOption('overlayClose', true) ) {
close();
}
});
}

/** Builds the content of a modal */
Expand Down Expand Up @@ -373,6 +377,15 @@
closeElem = undefined;
},

/**
* Updates the options for this modal. This will only let you
* change options that are re-evaluted regularly, such as
* `overlayClose`.
*/
options: function ( opts ) {
options = opts;
},

/** Executes after the DOM nodes are created */
afterCreate: returnIface(afterCreateEvent.watch),

Expand Down

0 comments on commit 01cbb39

Please sign in to comment.