[英]Bootstrap3 Navbar toggle is not working with requirejs
我正在使用BackboneJS,RequireJS和Bootstrap設計一個Web應用程序。 當我減小屏幕尺寸時,導航欄正在折疊,但是單擊事件在切換按鈕上不起作用。 當我不使用RequireJS時,我也曾遇到過同樣的問題。 那時,我已經在Head標記中包含了Jquery和BootstrapJS,並且對我有用。 現在,因為我使用RequireJS並面臨相同的問題。 誰能幫我這個忙嗎? 我在下面附加要求的配置代碼
require.config({
paths: {
jquery: '../lib/jquery',
underscore: '../lib/underscore',
backbone: '../lib/backbone',
router: 'router',
bootstrap: "//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min"
},
shim: {
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
'underscore': {
exports: '_'
},
'bootstrap': {
deps: ['jquery']
}
}
});
實際上,這是一個愚蠢的錯誤。 引導程序未包含在模塊中。
define([
'jquery',
'underscore',
'backbone',
'router',
'bootstrap'
],
function ($, _, Backbone, Router) {
var initialize = function () {
// Pass in our Router module and call it's initialize function
Router.initialize();
}
return {
initialize: initialize
};
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.