コメントと質問の更新に基づいて編集します。
タイムアウトするまで待つ必要があります。完全な関数はすぐには起動しません。yepnope.jsをダウンロードし、デモ/ index.htmlを実行し、ページの下部にjQueryをロードするyepnope呼び出しのすぐ下に次のコードを追加しました。
yepnope({
load : "http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js",
callback : function() { console.log("callback"); },
complete : function() { console.log("complete"); }
});
明らかに、jQuery1.6.2はロードされません。約10〜15秒後、コンソールに「コールバック」メッセージと「完了」メッセージの両方が表示されるので、それらが起動されていることがわかります。
Alernative:
オンライン/オフラインの開発にこの機能のみが必要であることがわかった場合は、 Html5Boilerplateが使用しているものを試してみてください。
<!-- Grab Google CDN's jQuery, with a protocol relative URL;
fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"
type="text/javascript"></script>
<script type="text/javascript">
window.jQuery || document.write('<script src="js/jquery-1.5.2.js">\x3C/script>')
</script>
これが私が個人的に使用するものです:
</form>
<!-- Javascript at the bottom for fast page loading -->
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript"> window.jQuery || document.write('<script src="js/jquery-1.5.2.js">\x3C/script>')</script>
<!-- Grab Google CDN's jQuery UI, with a protocol relative URL; fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript"> $.ui || document.write('<script src="js/jquery-ui-1.8.4.custom.min.js">\x3C/script>')</script>
<!-- Scripts concatenated and minified via ant build script-->
<script src="js/plugins.js" type="text/javascript"></script>
<script src="js/script.js" type="text/javascript"></script>
<!-- End scripts -->
</body>
</html>