Reputation: 11098
With the following CSS:
.ui-autocomplete-loading {
background: url('/icons/loading.gif') no-repeat right center;
}
When loading is first used the loading gif is downloaded, and I think it takes too long and therefore does not show the first time it is used. It is there for subsequent usages.
How do I ensure the gif is already downloaded (Note the loading.gif
is 2kb)
Upvotes: 0
Views: 703
Reputation: 3811
Preload it and cache it in the browser.
Somewhere on the page/in your javascript add this:
var image = new Image();
image.src = '/icons/loading.gif';
image.onload = function () {
console.log('loading gif is ready to go!'); // remove this in production
};
Upvotes: 2