additionals/assets/javascripts/additionals_delay_ajax_indicator.js
2017-12-11 15:12:01 +01:00

15 lines
430 B
JavaScript

function delayAjaxIndicator() {
$(document).off('ajaxSend').bind('ajaxSend', function(event, xhr, settings) {
if ($('.ajax-loading').length === 0 && settings.contentType != 'application/octet-stream') {
$('#ajax-indicator').stop(true, false).delay(300).show(0);
}
});
$(document).off('ajaxStop').bind('ajaxStop', function() {
$('#ajax-indicator').hide(0);
});
}
$(document).ready(delayAjaxIndicator);