根据您的评论和问题更新进行编辑:
您必须等待它超时。完整的功能不会立即触发。我刚刚下载了 yepnope.js 并运行了他们的 demo/index.html,并在他们的 yepnope 调用下添加了以下代码,该调用在页面底部加载了 jQuery:
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"); }
});
显然 jQuery 1.6.2 不会加载。大约 10-15 秒后,在控制台中,“回调”和“完成”消息都出现了,所以我知道他们被解雇了。
备选方案:
如果你发现你只需要这个功能来开发在线/离线,你可以试试我已经采用的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>