diff --git a/README.md b/README.md index 610f2cb..1f4fc24 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/picoModal.js b/src/picoModal.js index ff77c96..3086bd3 100644 --- a/src/picoModal.js +++ b/src/picoModal.js @@ -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 */ @@ -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),