1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Use e107.behaviors for ".e-dialog-close" elements.

This commit is contained in:
lonalore
2017-02-02 12:36:28 +01:00
parent 08a4804e8d
commit d7a5d90bb1

View File

@@ -280,6 +280,41 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
} }
}; };
/**
* Behavior to initialize Modal closer elements.
*
* @type {{attach: e107.behaviors.eDialogClose.attach}}
*/
e107.behaviors.eDialogClose = {
attach: function (context, settings)
{
$(context).find('.e-dialog-close').once('e-dialog-close').each(function ()
{
$(this).click(function ()
{
var $modal = $('.modal');
var $parentModal = parent.$('.modal');
var $parentDismiss = parent.$('[data-dismiss=modal]');
if($modal.length > 0)
{
$modal.modal('hide');
}
if($parentModal.length > 0)
{
$parentModal.modal('hide');
}
if($parentDismiss.length > 0)
{
$parentDismiss.trigger({type: 'click'});
}
});
});
}
};
/** /**
* Check if the selector is valid. * Check if the selector is valid.
* *
@@ -1116,15 +1151,6 @@ $(document).ready(function()
*/ */
$(document).on("click", ".e-dialog-close", function(){
parent.$('.modal').modal('hide');
$('.modal').modal('hide');
parent.$('[data-dismiss=modal]').trigger({ type: 'click' });
// $('#modal').modal('hide');
// parent.$.colorbox.close()
});