mirror of
https://github.com/e107inc/e107.git
synced 2025-04-20 04:32:01 +02:00
e-ajax data-loading-icon and data-loading-target attributes added.
This commit is contained in:
parent
af629e0a2b
commit
ca4a336454
@ -143,6 +143,10 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
method: $element.attr('data-method'),
|
||||
// Image to show loading.
|
||||
loading: $element.attr('data-loading'),
|
||||
// FontAwesome icon name.
|
||||
loadingIcon: $element.attr('data-loading-icon'),
|
||||
// ID or class of container to place loading-icon within. eg. #mycontainer or .mycontainer
|
||||
loadingTarget: $element.attr('data-loading-target'),
|
||||
// If this is a navigation controller, e.g. pager.
|
||||
nav: $element.attr('data-nav-inc'),
|
||||
// Old way - href='myscript.php#id-to-target.
|
||||
@ -551,6 +555,11 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
}
|
||||
}
|
||||
|
||||
if(options.loadingIcon != null && options.loadingTarget != null)
|
||||
{
|
||||
var loadHtml = '<i class="e-ajax-loading fa fa-spin '+ options.loadingIcon +'"></i>';
|
||||
$(options.loadingTarget).html(loadHtml);
|
||||
}
|
||||
|
||||
// Old way - href='myscript.php#id-to-target.
|
||||
if(options.target == null || options.url == null)
|
||||
@ -587,6 +596,11 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
data: data,
|
||||
complete: function ()
|
||||
{
|
||||
if(loadHtml)
|
||||
{
|
||||
$('.e-ajax-loading').hide();
|
||||
}
|
||||
|
||||
if($loadingImage)
|
||||
{
|
||||
$loadingImage.remove();
|
||||
|
Loading…
x
Reference in New Issue
Block a user