diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 024bfc6..43ee136 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -16,7 +16,6 @@ //// Default Options // Set some Defaults. var defaults = { - top: '15vh', overlayOpacity: 0.7, closeButton: '.js-leanmodal-close', disableCloseOnOverlayClick: false, @@ -28,12 +27,14 @@ options = $.extend(defaults, options) //// Close the Modal - // FUNCTION: Fade out the overlay and a passed identifier. + // FUNCTION: Fade out the overlay and a passed identifier while destroying the modal center aligner. function leanModal_Close(modal_id) { $('.js-leanmodal-overlay').fadeOut(options.fadeTime) $(modal_id).fadeOut(options.fadeTime) $('.js-leanmodal-overlay').unbind('click') $(document).off('keyup') + $(modal_id).appendTo('body') + $('.js-leanmodal-aligner').remove() } //// There can be only one. @@ -106,15 +107,13 @@ if ( options.modalCenter ) { $(modal_id).css({ 'display': 'block', - //'left': 50 + '%', - //'margin-left': - ( modal_width / 2 ) + 'px', - 'margin-left': '50%', - 'transform': 'translateX(-50%)', 'opacity': 0, - 'position': 'fixed', - 'top': options.top, 'z-index': 11000, }) + var style = 'display: flex; align-items: center; justify-content: center; position: fixed; top: 0px; width: 100vw; height: 100vh; z-index: 11000' + var modalAligner = $('