From 68282c93f40de17d5d9044797a517b876c09995e Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 11 Aug 2021 00:12:48 +1000 Subject: [PATCH] Start API calls before the panel has finished loading --- InvenTree/templates/js/dynamic/nav.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/InvenTree/templates/js/dynamic/nav.js b/InvenTree/templates/js/dynamic/nav.js index d3d27d62f7..601c0f4dcf 100644 --- a/InvenTree/templates/js/dynamic/nav.js +++ b/InvenTree/templates/js/dynamic/nav.js @@ -72,8 +72,11 @@ function activatePanel(panelName, options={}) { // Display the panel $(panel).addClass('panel-visible'); + + // Load the data + $(panel).trigger('fadeInStarted'); + $(panel).fadeIn(100, function() { - $(panel).trigger('fadeInComplete'); }); // Un-select all selectors @@ -86,7 +89,6 @@ function activatePanel(panelName, options={}) { } - function onPanelLoad(panel, callback) { // One-time callback when a panel is first displayed // Used to implement lazy-loading, rather than firing @@ -94,13 +96,13 @@ function onPanelLoad(panel, callback) { var panelId = `#panel-${panel}`; - $(panelId).on('fadeInComplete', function(e) { + $(panelId).on('fadeInStarted', function(e) { // Trigger the callback callback(); // Turn off the event - $(panelId).off('fadeInComplete'); + $(panelId).off('fadeInStarted'); }); } \ No newline at end of file