question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overlay hiding not working when using both AjaxStart and custom svg file

See original GitHub issue

How to reproduce:

  1. As mentioned in the docs, set the Ajax requests to trigger the loadingOverlay
$(document).ajaxStart(function(){
    $.LoadingOverlay("show");
});
$(document).ajaxStop(function(){
    $.LoadingOverlay("hide");
});
  1. Then in a custom jquery/javascript function, for example in my case on a button click, trigger the loadingOverlay
$.LoadingOverlay("show"); 
  1. When the request ends and you want to close the overlay, simply call:
$.LoadingOverlay("hide");

Expected behavior: Close the overlay Observed behavior: The overlay is not hidden correctly

In fact, the problem is that 2 instances of the overlay are created. One for custom request which creates a new overlay, which is fine as we call the $.LoadingOverlay("show");, and another one caused by the AjaxStart event, triggered by the SVG file element.load() call

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gasparesgangacommented, Jun 7, 2018

That turned out to be an easier fix than expected. jQuery’s parameter global for Ajax method came in handy. I will release the patched version in a few minutes.

0reactions
lvmajorcommented, Jun 7, 2018

Glad I could help a bit 😃 Thanks for the quick patch!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I create a "Please Wait, Loading..." animation using ...
The approach I'm taking below will show you how to accomplish both methods. ... a loading overlay, keep it hidden and then unhide...
Read more >
jQuery LoadingOverlay - Gaspare Sganga
It supports both raster images and vectorial SVGs. You can pass an inline SVG, a path to a file or even use a...
Read more >
.ajaxStart() | jQuery API Documentation
Any and all handlers that have been registered with the .ajaxStart() method are executed at this time. To observe this method in action,...
Read more >
Simple Flexible Loading Overlay Plugin With jQuery
loadingoverlay.js is a simple, flexible jQuery plugin which shows a highly customizable loading overlay with custom spinners while loading ...
Read more >
Wikipedia, the free encyclopedia.webarchive
display: block; height: 0; clear: both; visibility: hidden; ... Uses DOM calls to avoid document.write + XHTML issues var linkHolder = document.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found