jquery1.7以上的都支持模塊化加載,只是jquery默認的是支持amd,不支持cmd。因此要用seajs加載jquery時,咱們須要稍微作下改動,須要把如下內容作下修改,具體修改方式以下:jquery
把mvc
1
2
3
4
5
|
if
(
typeof
define ===
"function"
&& (define.amd)) {
define(
"jquery"
, [],
function
() {
return
jQuery;
});
}
|
改爲app
1
2
3
4
5
|
if
(
typeof
define ===
"function"
&& (define.amd || define.cmd)) {
define(
"jquery"
, [],
function
() {
return
jQuery;
});
}
|
或模塊化
1
2
3
4
5
|
if
(
typeof
define ===
"function"
) {
define(
"jquery"
, [],
function
() {
return
jQuery;
});
}
|
經過以上代碼的修改就能夠成功解決seajs加載jquery時提示$ is not a function問題,但願對你們有所幫助。url