diff --git a/scp/js/scp.js b/scp/js/scp.js
index b489006e1c67b774307efb890ba566815033361a..36819fa6676bcfa6b754ad7858ca5dad186c8fbc 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -631,42 +631,46 @@ getConfig = (function() {
     }
 })();
 
-$(document).on('pjax:start', function(event) {
-    // Don't show the spinner on back button
-    if (event instanceof PopStateEvent)
-        return;
-
-    clearInterval(window.ticket_refresh);
-    // Clear all timeouts
-    var id = window.setTimeout(function() {}, 0);
-    while (id--) {
-      window.clearTimeout(id);
-    }
-
-    if ($("#loadingbar").length === 0) {
-      $("body").append("<div id='loadingbar'></div>");
-      $("#loadingbar").addClass("waiting").append($("<dt/><dd/>"));
-
-      // right
-      $("#loadingbar").width((50 + Math.random() * 30) + "%");
-      $('#overlay').css('background-color','white').fadeIn();
-    }
-
+$(document).on('pjax:click', function(options) {
+    if (window.ticket_refresh !== undefined)
+        clearInterval(window.ticket_refresh);
+    // Release ticket lock (maybe)
+    if ($.autoLock !== undefined)
+        $.autoLock.releaseLock();
+    // Stop all animations
+    $(document).stop(false, true);
     // Cancel save-changes warning banner
     $(document).unbind('pjax:beforeSend.changed');
     $(window).unbind('beforeunload');
 });
-$(document).on('pjax:end', function() {
+
+$(document).on('pjax:send', function(event) {
+    if ($('#loadingbar').length !== 0) {
+        $('#loadingbar').remove();
+    }
+
+    $("body").append("<div id='loadingbar'></div>");
+    $("#loadingbar").addClass("waiting").append($("<dt/><dd/>"));
+
+    // right
+    $('#loadingbar').stop(false, true).width((50 + Math.random() * 30) + "%");
+    $('#overlay').css('background-color','white').fadeIn();
+});
+
+$(document).on('pjax:complete', function() {
     // right
     $("#loadingbar").width("101%").delay(200).fadeOut(400, function() {
         $(this).remove();
     });
-    $('#overlay').hide().removeAttr('style');
+    $('#overlay').stop(false, true).hide().removeAttr('style');
+});
 
+$(document).on('pjax:end', function() {
     // Close popups
     // Close tooltips
     $('.tip_box').empty().hide();
     $('.dialog .body').empty().parent().hide();
+    $('#overlay').hide();
 });
 
 // Quick note interface