Execute a code first of all

Asked

Viewed 72 times

0

Good morning. When I press any MENU, BUTTON, link, etc everything works correctly and perfectly, however, there are hours that the code to be executed takes, sometimes a little, sometimes more than a little. It bothers me a lot because I do not know if I clicked, then I click again. This sensation must be the same as a user. So what I’d like to do is make an hourglass appear BEFORE ANYTHING.
The hourglass/ wait I already know how to do. I use this way:
https://github.com/raphaelfabeni/css-loader

On some buttons on the onclick that calls a function I "trigger" the HOURGLASS APPEARANCE/WAIT, and at the end of the execution of the function I "SHOOT" the HOURGLASS/WAIT. With this if I am processing something on the server or a longer task, I show the user that something is happening... and when the task is finished the hourglass goes away and the user knows that he can proceed.
What I would like to learn to do is when I click on an exe menu item:

<li><a href='especialidade_01.php'>Especialidades</a></li>");

this page of this menu item already comes with the HOURGLASS/WAIT "loaded" and at the end of the "loading" of the page "TAKE OUT" the "HOURGLASS/WAIT".
There are times I click on a menu item and the page takes a while to appear.. very annoying indeed.
Sorry for the words/terminology I used to report but I really don’t know yet how to call/describe this situation appropriately for lack of experience..

  • Good afternoon @Leocaracciolo .. First I want to thank you for your attention :).. I will take a look. : ) thank you

  • @Leocaracciolo Ola.. guy read the link you passed.. but from what I understand it is to show AFTER loading.. Isn’t it?? Hugs.

1 answer

0

in the <body>you can put a onload with that function

<body onload="nomeDaFuncao()">

Serves?

  • Constamilam Ola.. Thank you for answering :) . Face the code is called up, but NOT at menu click TIME. If I leave the browser stationary on the main screen where the menus are and after a few minutes click on the menu I want, it takes a while to load ( it is running a load in the Rowse tab for a while, THEN it calls the function that is in onload.

  • You can call in the onclick of the menu, so when the user clicks on the menu option will appear that is loading and when load the other page will already be gone

  • Constamilam.. that’s exactly what I was thinking about here.. I’m trying to do a javascript so by clicking any menu call the load :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.