From 40f0304affc57e28aeeaa2089637535cdfa53f75 Mon Sep 17 00:00:00 2001 From: Mike Olund Date: Mon, 27 Mar 2017 11:08:13 -0700 Subject: [PATCH] DIV-323 - progress spinner / back-button issue --- edivorce/apps/core/static/js/main.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/edivorce/apps/core/static/js/main.js b/edivorce/apps/core/static/js/main.js index 450a3ca2..f7e6d190 100755 --- a/edivorce/apps/core/static/js/main.js +++ b/edivorce/apps/core/static/js/main.js @@ -95,9 +95,14 @@ $(function () { }); // spinner - $('input.spinner, a.spinner').on('click', function () { + $('a.spinner').on('click', function (e) { + e.preventDefault(); + var href = $(this).attr('href'); $('div#progress-overlay').show(); $('div#progress-overlay-spinner').spin('large'); + setTimeout(function(){ + window.location.href = href; + }, 0); }); $('a.save-spinner').on('click', function (e) { @@ -114,6 +119,11 @@ $(function () { }); + // kills the spinner when the back button is pressed + $(window).on('beforeunload', function () { + $('div#progress-overlay').hide(); + $('div#progress-overlay-spinner').spin(false); + }); }); // delete and added field and save the change @@ -197,8 +207,3 @@ $('.no-collapse').on('click', function (e) { e.stopPropagation(); }); -// kills the spinner when the back button is pressed -window.onunload = function () { - $('div#progress-overlay').hide(); - $('div#progress-overlay-spinner').spin(false); -};