From a17f8609a0ce5eeb34db45c391d716e1aa0dc31a Mon Sep 17 00:00:00 2001 From: Patrick Shannon <31411889+p-shannon@users.noreply.github.com> Date: Mon, 12 Feb 2018 16:36:35 -0500 Subject: [PATCH 1/6] Changes centering calculations for modals --- jQuery.leanModal2.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 024bfc6..956a6b9 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -108,13 +108,19 @@ 'display': 'block', //'left': 50 + '%', //'margin-left': - ( modal_width / 2 ) + 'px', - 'margin-left': '50%', - 'transform': 'translateX(-50%)', + //'margin-left': '50%', + //'transform': 'translateX(-50%)', 'opacity': 0, - 'position': 'fixed', + //'position': 'fixed', //fixed position will relinquish flexbox's influence 'top': options.top, 'z-index': 11000, }) + $(modal_id).parent.().css({ + 'display':'flex', + 'align-items':'center', + 'justify-content':'center', + 'position':'fixed', + }) } //// Curtain Up From 0dc24e2ebc6be6bd810c27c87d79e98cd6a3ea83 Mon Sep 17 00:00:00 2001 From: Patrick Shannon <31411889+p-shannon@users.noreply.github.com> Date: Mon, 12 Feb 2018 18:29:39 -0500 Subject: [PATCH 2/6] Fix a syntax error --- jQuery.leanModal2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 956a6b9..1f4cfb6 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -115,7 +115,7 @@ 'top': options.top, 'z-index': 11000, }) - $(modal_id).parent.().css({ + $(modal_id).parent().css({ 'display':'flex', 'align-items':'center', 'justify-content':'center', From 704b6de3e811b8e556399a5771c5272c9bf67c4d Mon Sep 17 00:00:00 2001 From: Patrick Shannon Date: Tue, 13 Feb 2018 23:00:28 -0500 Subject: [PATCH 3/6] Creates an aligner for the modal and centers it using flex only when center is enabled. --- jQuery.leanModal2.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 1f4cfb6..ca2d503 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -28,12 +28,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. @@ -115,12 +117,10 @@ 'top': options.top, 'z-index': 11000, }) - $(modal_id).parent().css({ - 'display':'flex', - 'align-items':'center', - 'justify-content':'center', - 'position':'fixed', - }) + var style = 'display: flex; align-items: center; justify-content: center; position: fixed; top: 0px; width: 100vw; height: 100vh; z-index: 11000' + var modalAligner = $(`
Date: Tue, 13 Feb 2018 23:03:09 -0500 Subject: [PATCH 4/6] Pacifiies the linter gods --- jQuery.leanModal2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index ca2d503..5af58a4 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -118,7 +118,7 @@ '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 = $(`
Date: Tue, 13 Feb 2018 23:05:03 -0500 Subject: [PATCH 5/6] Second time's the charm. (linting) --- jQuery.leanModal2.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 5af58a4..99ce822 100644 --- a/jQuery.leanModal2.js +++ b/jQuery.leanModal2.js @@ -117,10 +117,10 @@ '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 = $('
Date: Wed, 14 Feb 2018 22:59:23 +0000 Subject: [PATCH 6/6] Remove dead options (also no longer use top) --- jQuery.leanModal2.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/jQuery.leanModal2.js b/jQuery.leanModal2.js index 99ce822..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,7 +27,7 @@ options = $.extend(defaults, options) //// Close the Modal - // FUNCTION: Fade out the overlay and a passed identifier while destroying the modal center aligner.. + // 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) @@ -108,13 +107,7 @@ 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', //fixed position will relinquish flexbox's influence - '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'