at the moment I try to give my site a small speed boost by loading most of my scripts asynchronous. As I am using Modernizr anyway it’s a good thing I believe, but I am having serious problem getting everything in a logical order.
I already tried to write it down on paper multiple times, but also having problems with understanding how to use document ready together with Modernizr.load does not make things less complicated.
Here is what I got so far “theoretically”:
First, I load the Modernizr script in the head, followed by my script, lets call it myscript.js. In that file, I do all my async calls.
First load jQuery. While jQuery loads, I can start doing the Modernizr tests I need and if one of them fails, I load my polyfills.js (holds all poyfills). In the callback, I set them up and initialize them. Next, I start loading a script that enables me to print some latest tweets anywhere on that page. In the callback, I set everything up and initialize. I also have a script that I only need on one page when a specific div exists, so I test for this, set everything up and init. I also have one or two short simple one-liners, where do I put those?
As you probably figured out, this isn’t even working due to my document ready problem, which is very frustrating because I spent the second whole working on it. Of course I already did a Google search and found some fancy script where you can create your own namespace or something like that, but I simply don’t understand that.
So please help me, I would really appreciate that :-)
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
*May or may not contain any actual "CSS" or "Tricks".