Skip to content
Snippets Groups Projects
Commit db7bb95c authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Fixed AJAX initialization.

parent dc352578
No related branches found
No related tags found
No related merge requests found
...@@ -141,25 +141,24 @@ ...@@ -141,25 +141,24 @@
* @param context * @param context
* @param settings * @param settings
*/ */
attach : function(context, settings) { attach : function(context, settings) {
// Initialize general loading animation. // Initialize general loading animation.
Drupal.behaviors.jquery_loadinganimation.Loadinganimation = new Loadinganimation(context, settings.jquery_loadinganimation); Drupal.behaviors.jquery_loadinganimation.Loadinganimation = new Loadinganimation(context, settings.jquery_loadinganimation);
if (context == document) {
if (context == document) { // Global context!
// Global context! if (settings.jquery_loadinganimation.show_on_ajax) {
if (settings.show_on_ajax) { // Register loading animations for ajax events!
// Register loading animations for ajax events! $(context).ajaxSend(function() {
$(context).ajaxSend(function() { // Show loading animation on request.
// Show loading animation on request. Drupal.behaviors.jquery_loadinganimation.Loadinganimation.show();
Drupal.behaviors.jquery_loadinganimation.Loadinganimation.show(); });
});
$(context).ajaxSuccess(function() { $(context).ajaxSuccess(function() {
// Hide loading animation after finish. // Hide loading animation after finish.
Drupal.behaviors.jquery_loadinganimation.Loadinganimation.hide(); Drupal.behaviors.jquery_loadinganimation.Loadinganimation.hide();
}); });
} }
} }
} }
}; };
})(jQuery); })(jQuery);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment