Widget Building: Uncaught TypeError: Object [object Object] has no method 'fancybox'
<p>Why is it that this works: <a href="http://jsfiddle.net/w82W8/1/" rel="nofollow">http://jsfiddle.net/w82W8/1/</a>
But this doesn't?: <a href="http://jsfiddle.net/w82W8/2/" rel="nofollow">http://jsfiddle.net/w82W8/2/</a></p>

<p>This question may seem convoluted; you may wonder, why not just use the first!? Why are you using jQuery to load in JS+CSS assets that you could easily load in the original HTML.</p>

<p>Well, I'm in the process of building a web widget and I'd like to keep the embed code as small as possible. The idea is to have the user include a single <code>&lt;script type='text/javascript' src='http://mysite.com/widget.js'&gt;&lt;/script&gt;</code> line in their code, and the widget.js code will take care of all the details. Including fetching fancybox.</p>

<p>I'm getting the error: <strong>Uncaught TypeError: Object [object Object] has no method 'fancybox'</strong></p>

<p>I hypothesize that javascript is not waiting for fancybox.js to load, and immediately attempting to apply fancybox() to the trigger. Can I get a callback working here when the assets have been loaded? I'm certain they are getting included in the DOM though... I've inspected with Chrome Tools.</p>

<p>I know this question has been asked on StackOverflow before, but not in this context.</p>

<p>Thanks, and Happy Holidays!</p>
