|
@ -56,10 +56,13 @@ $.fn.modal = function(parameters) { |
|
|
modal = { |
|
|
modal = { |
|
|
|
|
|
|
|
|
initialize: function() { |
|
|
initialize: function() { |
|
|
modal.verbose('Initializing modal'); |
|
|
|
|
|
|
|
|
modal.verbose('Attaching events'); |
|
|
$closeButton |
|
|
$closeButton |
|
|
.on('click', modal.event.close) |
|
|
.on('click', modal.event.close) |
|
|
; |
|
|
; |
|
|
|
|
|
modal.cache.sizes(); |
|
|
|
|
|
|
|
|
|
|
|
modal.verbose('Creating dimmer'); |
|
|
$context |
|
|
$context |
|
|
.dimmer({ |
|
|
.dimmer({ |
|
|
closable: settings.closable, |
|
|
closable: settings.closable, |
|
@ -81,12 +84,11 @@ $.fn.modal = function(parameters) { |
|
|
$dimmer = $context.children(selector.dimmer); |
|
|
$dimmer = $context.children(selector.dimmer); |
|
|
if( $modal.parent()[0] !== $dimmer[0] ) { |
|
|
if( $modal.parent()[0] !== $dimmer[0] ) { |
|
|
modal.debug('Moving element inside dimmer', $context); |
|
|
modal.debug('Moving element inside dimmer', $context); |
|
|
$modal |
|
|
|
|
|
|
|
|
$modal = $modal |
|
|
.detach() |
|
|
.detach() |
|
|
.appendTo($dimmer) |
|
|
.appendTo($dimmer) |
|
|
; |
|
|
; |
|
|
} |
|
|
} |
|
|
modal.cache.sizes(); |
|
|
|
|
|
modal.instantiate(); |
|
|
modal.instantiate(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -140,6 +142,7 @@ $.fn.modal = function(parameters) { |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
show: function() { |
|
|
show: function() { |
|
|
|
|
|
modal.debug('Showing modal'); |
|
|
modal.set.type(); |
|
|
modal.set.type(); |
|
|
modal.set.position(); |
|
|
modal.set.position(); |
|
|
modal.hideAll(); |
|
|
modal.hideAll(); |
|
@ -153,10 +156,12 @@ $.fn.modal = function(parameters) { |
|
|
.fadeIn(settings.duration, settings.easing, modal.set.active) |
|
|
.fadeIn(settings.duration, settings.easing, modal.set.active) |
|
|
; |
|
|
; |
|
|
} |
|
|
} |
|
|
|
|
|
modal.debug('Triggering dimmer'); |
|
|
$context.dimmer('show'); |
|
|
$context.dimmer('show'); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
hide: function() { |
|
|
hide: function() { |
|
|
|
|
|
modal.debug('Hiding modal'); |
|
|
// remove keyboard detection
|
|
|
// remove keyboard detection
|
|
|
$document |
|
|
$document |
|
|
.off('keyup.' + namespace) |
|
|
.off('keyup.' + namespace) |
|
@ -209,6 +214,7 @@ $.fn.modal = function(parameters) { |
|
|
? $(window).height() |
|
|
? $(window).height() |
|
|
: $context.height() |
|
|
: $context.height() |
|
|
}; |
|
|
}; |
|
|
|
|
|
console.log($modal); |
|
|
modal.debug('Caching modal and container sizes', modal.cache); |
|
|
modal.debug('Caching modal and container sizes', modal.cache); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
@ -240,7 +246,7 @@ $.fn.modal = function(parameters) { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
position: function() { |
|
|
position: function() { |
|
|
modal.verbose('Centering modal on page'); |
|
|
|
|
|
|
|
|
modal.verbose('Centering modal on page', modal.cache.height / 2); |
|
|
if(modal.can.fit()) { |
|
|
if(modal.can.fit()) { |
|
|
$modal |
|
|
$modal |
|
|
.css({ |
|
|
.css({ |
|
|