Efe*_*Efe 2 javascript jquery counter drupal drupal-7
我的代码在本地环境中运行良好,但在网站上运行不佳。我不明白我在这里缺少什么。
代码:
jQuery(document).ready(function(){
'use strict';
//============================== COUNTER-UP =========================
$('.counter').counterUp({
delay: 10,
time: 2000
});
});
Run Code Online (Sandbox Code Playgroud)
错误信息:
Uncaught TypeError: $ is not a function
at HTMLDocument.<anonymous> (custom.js?p4xosk:4)
at fire (jquery.js?v=1.10.2:3048)
at Object.fireWith [as resolveWith] (jquery.js?v=1.10.2:3160)
at Function.ready (jquery.js?v=1.10.2:433)
at HTMLDocument.completed (jquery.js?v=1.10.2:104)
Run Code Online (Sandbox Code Playgroud)
你必须定义 $ :
(function($){
$(document).ready(function(){
'use strict';
//============================== COUNTER-UP =========================
$('.counter').counterUp({
delay: 10,
time: 2000
});
});
})(jQuery);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2391 次 |
| 最近记录: |