How to show "loading" icon or message

I guess you are wanting something like this old jquery example (which could be converted to vanilla js if needed).

Of course its probably not as simple as that because if you are only wanting the element to spin while the page is processing something then it all needs to be tied into a processing script of some sort depending on the action you are taking.

Also if you are expecting this to work on the page that you are linking to then that will only work if you apply the routine on the linked page and set it to run while the page is loading. Otherwise as soon as you click a link the current page is lost anyway unless you are doing some processing and the new page would take over.

You probably need to clarify exactly what you intend to do with this and is probably a question for the JS forum. The css can apply the positioning etc but js will be needed for all the processing etc.

There are many tutorials on the web so do a google :slight_smile:

https://www.sitepoint.com/introduction-jquery-shorthand-ajax-methods/
https://www.sitepoint.com/css3-ajax-loading-icon/
http://jsfiddle.net/VpDUG/4952/

1 Like