Skip to content
Open
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
18 changes: 12 additions & 6 deletions messi.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ function Messi(data, options) {
};

// activamos la pantalla modal
_this.modal = (_this.options.modal) ? jQuery('<div class="messi-modal"></div>').css({opacity: _this.options.modalOpacity, width: jQuery(document).width(), height: jQuery(document).height(), 'z-index': _this.options.zIndex + jQuery('.messi').length}).appendTo(document.body) : null;
_this.modal = (_this.options.modal) ? jQuery('<div class="messi-modal"></div>').css({opacity: _this.options.modalOpacity, width: jQuery(document).width(), height: jQuery(document).height(), 'z-index': _this.options.zIndex + jQuery('.messi').length}) : null;

// mostramos el mensaje
if(_this.options.show) _this.show();

Expand Down Expand Up @@ -148,8 +148,13 @@ Messi.prototype = {

if(this.visible) return;

if(this.options.modal && this.modal != null) this.modal.show();
this.messi.appendTo(document.body);
if (this.messi.parent().length == 0) {
// en caso de unload o primer llamamiento
this.modal && this.modal.appendTo(document.body);
this.messi.appendTo(document.body);
}

this.modal && this.modal.show();

// obtenemos el centro de la pantalla si la opción de centrar está activada
if(this.options.center) this.options.viewport = this.viewport(jQuery('.messi-box', this.messi));
Expand All @@ -169,8 +174,8 @@ Messi.prototype = {
var _this = this;

this.messi.animate({opacity: 0}, 300, function() {
if(_this.options.modal && _this.modal != null) _this.modal.remove();
_this.messi.css({display: 'none'}).remove();
_this.modal && _this.modal.css({display: 'none'});
_this.messi.css({display: 'none'});
// reactivamos el scroll
//document.documentElement.style.overflow = "visible";
_this.visible = false;
Expand Down Expand Up @@ -200,6 +205,7 @@ Messi.prototype = {
unload: function() {
if (this.visible) this.hide();
jQuery(window).unbind('resize', function () { this.resize(); });
this.modal && this.modal.remove();
this.messi.remove();
},

Expand Down