mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 13:47:31 +02:00
e-ajax data-loading-icon and data-loading-target attributes added.
This commit is contained in:
@@ -143,6 +143,10 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
|||||||
method: $element.attr('data-method'),
|
method: $element.attr('data-method'),
|
||||||
// Image to show loading.
|
// Image to show loading.
|
||||||
loading: $element.attr('data-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.
|
// If this is a navigation controller, e.g. pager.
|
||||||
nav: $element.attr('data-nav-inc'),
|
nav: $element.attr('data-nav-inc'),
|
||||||
// Old way - href='myscript.php#id-to-target.
|
// 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.
|
// Old way - href='myscript.php#id-to-target.
|
||||||
if(options.target == null || options.url == null)
|
if(options.target == null || options.url == null)
|
||||||
@@ -587,6 +596,11 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
|||||||
data: data,
|
data: data,
|
||||||
complete: function ()
|
complete: function ()
|
||||||
{
|
{
|
||||||
|
if(loadHtml)
|
||||||
|
{
|
||||||
|
$('.e-ajax-loading').hide();
|
||||||
|
}
|
||||||
|
|
||||||
if($loadingImage)
|
if($loadingImage)
|
||||||
{
|
{
|
||||||
$loadingImage.remove();
|
$loadingImage.remove();
|
||||||
|
Reference in New Issue
Block a user