2
我在项目中使用requirejs,一切都运行平稳。直到我不得不在我的项目中添加一个名为'elastislide'的jquery插件。我正在使用shim配置来指定插件对jquery和jquery ++的依赖关系。这就像如下:通过RequireJS加载jquery插件
requirejs.config({
paths: {
jquery: 'libs/jquery',
jquerymobile: 'libs/jquery-mobile/jquery.mobile',
underscore: 'libs/underscore',
jquerypp: 'libs/jquerypp',
elastislide: '../js/elastislide',
app: '../js/app',
model: '../js/app/model',
view: '../js/app/view',
controller: '../js/app/controller',
shim: {
'elastislide': {
deps: ['jquery', 'jquerypp']
}
}
}
});
而且在我的应用程序入口点我有这样的:
define([
'jquery',
'jquerymobile',
'jquerypp/event/swipe',
'elastislide',
'model',
'view',
'controller'
], function ($, mobile, jqpp, elastislide, model, view, controller) {
//
而且我不断收到错误消息:“未捕获的ReferenceError:未定义jQuery的”。我已经修改了requirejs文档并且看不到错误。任何人都可以请点解决方案?
这里是插件的网站:http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/
在此先感谢!
它仍然无法正常工作。现在我用这个改变编辑了这个问题。 – XVirtusX 2014-10-06 17:55:11