seajs加载jquery提示$ is not a function

jquery1.7以上的都支持模块化加载,只是jquery默认的是支持amd,不支持cmd。所以要用seajs加载jquery,需要稍微改下jquery

 

1 if (typeof define === "function" && (define.amd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

改成

1 if (typeof define === "function" && (define.amd || define.cmd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

1 if (typeof define === "function") {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

就可以了

posted @ 2015-10-23 09:33  guozhuanghu  阅读(1381)  评论(1编辑  收藏  举报