From 3bc7f0a1247fddee88cf81909f1ce4958e371ca2 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 4 Sep 2018 09:41:26 +0200 Subject: [PATCH] wait for animations to be done --- .../components/application/umbtour.directive.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour.directive.js index 7333d033b1..2970c52bbb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umbtour.directive.js @@ -455,13 +455,28 @@ In the following example you see how to run some custom logic before a step goes function waitForPendingRerequests() { var deferred = $q.defer(); var timer = window.setInterval(function(){ + + var requestsReady = false; + var animationsDone = false; + // check for pending requests both in angular and on the document if($http.pendingRequests.length === 0 && document.readyState === "complete") { + requestsReady = true; + } + + // check for animations. ng-enter and ng-leave are default angular animations. + // Also check for infinite editors animating + if(document.querySelectorAll(".ng-enter, .ng-leave, .umb-editor--animating").length === 0) { + animationsDone = true; + } + + if(requestsReady && animationsDone) { $timeout(function(){ deferred.resolve(); clearInterval(timer); }); } + }, 50); return deferred.promise; }