Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions jQuery.leanModal2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
//// Default Options
// Set some Defaults.
var defaults = {
top: '15vh',
overlayOpacity: 0.7,
closeButton: '.js-leanmodal-close',
disableCloseOnOverlayClick: false,
Expand All @@ -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.
Expand Down Expand Up @@ -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 = $('<div class="js-leanmodal-aligner" style="' + style + '"></div')
$(modal_id).parent().append(modalAligner)
$(modal_id).appendTo('.js-leanmodal-aligner')
}

//// Curtain Up
Expand Down