繁体   English   中英

Bootstrap3 Navbar切换不适用于requirejs

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM