【发布时间】:2015-12-01 13:46:02
【问题描述】:
我收到以下错误,当我使用自举滑块 (https://github.com/seiyria/bootstrap-slider)在我的电子(http://electron.atom.io/docs/latest/tutorial/quick-start/)应用程式:
“未捕获类型错误:$(...)滑块不是一个函数” P>
早些时候,我还使用jQuery挣扎,但使用解决它: https://github.com/atom/electron/issues/254:
。窗口$ = window.jQuery =需要( '/路径/到/ jquery的'); 代替常规的:
引述的原因是 查询包含沿着此路线的东西:
if ( typeof module === "object" && typeof module.exports === "object" ) {
// set jQuery in `module`
} else {
// set jQuery in `window`
}
我不明白什么是用它来引导滑块以正确的方式。 P>
我可以看到,自举-slider.js具有分量对付“模块”,这可能会引起异常就像在jquery的。 P>
(function(root, factory) {
if(typeof define === "function" && define.amd) {
define(["jquery"], factory);
} else if(typeof module === "object" && module.exports) {
var jQuery;
try {
jQuery = require("jquery");
} catch (err) {
jQuery = null;
}
module.exports = factory(jQuery);
} else {
root.Slider = factory(root.jQuery);
}
请告诉我如何处理这个问题。 P>
【问题讨论】:
标签: javascript jquery twitter-bootstrap node-webkit nativeapplication