diff --git a/src/remodal.js b/src/remodal.js index 981cea2..b1fe1d3 100644 --- a/src/remodal.js +++ b/src/remodal.js @@ -70,7 +70,8 @@ closeOnCancel: true, closeOnEscape: true, closeOnOutsideClick: true, - modifier: '' + modifier: '', + appendTo: null }, global.REMODAL_GLOBALS && global.REMODAL_GLOBALS.DEFAULTS); /** @@ -497,6 +498,7 @@ */ function Remodal($modal, options) { var $body = $(document.body); + var $appendTo = $body; var remodal = this; remodal.settings = $.extend({}, DEFAULTS, options); @@ -505,9 +507,13 @@ remodal.$overlay = $('.' + namespacify('overlay')); + if (remodal.settings.appendTo !== null && remodal.settings.appendTo.length) { + $appendTo = $(remodal.settings.appendTo); + } + if (!remodal.$overlay.length) { remodal.$overlay = $('