0

我正在尝试让Sidr 插件在 Durandal 中工作。这就是我所拥有的

主.js

requirejs.config({
paths: {
    'text': '../lib/require/text',
    'async': '../lib/require/async',
    'durandal': '../lib/durandal/js',
    'plugins': '../lib/durandal/js/plugins',
    'transitions': '../lib/durandal/js/transitions',
    'knockout': '../lib/knockout/knockout-2.3.0',
    'bootstrap': '../lib/bootstrap/js/bootstrap',
    'sidr': '../lib/sidr/jquery.sidr.min',
    'jquery': '../lib/jquery/jquery-1.9.1'
},
shim: {
    'bootstrap': {
        deps: ['jquery'],
        exports: 'jQuery'
    },
    'sidr': {
        deps: ['jquery']
    }

  }
});

Shell.js

define(['plugins/router', 'durandal/app', 'sidr'], function (router, app, sidr) {

return {
  router:router,
  activate:{...},
    compositionComplete: function (view, parent) {
            $('#simple-menu').sidr();

       return true;
    }
 }

壳牌.html

<div data-bind="compose: { view: 'nav' }"></div>

<div id="wrap" class="container">
   <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">

            <div class="menuicon pull-left">
                <a id="simple-menu" href="">
                    <img alt="#" src="images/menu.png" /></a>
            </div>
     </div>
   </div>

导航.html

<nav>
...
</nav>

简单地总结我的问题......它不起作用!当我单击菜单按钮时,没有任何反应。我需要做些什么不同的事情?

4

1 回答 1

0

I think that you need to name the nav element if it is the menu:

<nav id="sidr">
...
</nav>
于 2013-11-08T20:49:59.987 回答