Tutorial :jQuery Execution?



Question:

My jQuery script has a glitch animating a div position. The bug seems to occur when I click the link right as the page is loading.


Solution:1

The bug seems to occur when I click the link right as the page is loading

This is because you are using the ready function and that executes as soon as the page has finished loading.

Thus, if you click on something whilst the page is still loading keep in mind that the JavaScript in that ready function has not been executed yet.


The reason why you can't always reproduce it most probably because the page will be cached the second time round and you wouldn't have time to click anything before the page has finished loading (since it's cached) and thus the js code would have been executed already when you click.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »