Symfony2 with BraincraftedBootstrapBundle:单击时,切换按钮不会打开

时间:2014-11-14 18:49:40

标签: php jquery symfony

我不明白为什么相同的代码在我的php博客中起作用,而不是在Symfony2中使用Braincrafted ...与Assetic一起安装(我已阅读有关切换/可折叠按钮的讨论不可点击)。在这两种情况下,我都有数据目标="#main-menu"并且下面的DIV具有相同的id ="主菜单"。任何的想法? 我在Symfony2中的代码:                                                                              切换导航                                                                                             

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="main-menu">
            <ul class="nav nav-justified navbar-inverse">
                <!-- if connection page, class name = active -->
                <li class="{{ app.request.attributes.get('_route') == 'fos_user_security_login'?'active':' ' }}">
                    <a href="{{ path( 'fos_user_security_login' ) }}">
                        {{ 'nav.login'|trans|upper }}
                    </a>
                </li>

                <!-- if registration page, class name = active -->
                <li class="{{ app.request.attributes.get('_route') == 'fos_user_registration_register'?'active':' ' }}">
                    <a href="{{ path( 'fos_user_registration_register' ) }}">
                        {{ 'nav.register'|trans|upper }}
                    </a>
                </li>

                <!-- if passwordForgotten page, class name = active -->
                <li class="{{ app.request.attributes.get('_route') == 'fos_user_resetting_request'?'active':' ' }}">
                    <a href="{{ path( 'fos_user_resetting_request' ) }}">
                        {{ 'nav.passwordForgotten'|trans|upper }}
                    </a>
                </li>

            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

我在php博客中的代码:                                                                              切换导航                                                                                                 博客MVC&lt; / a&gt;                  - &GT;             

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="main-menu">
            <ul class="nav nav-justified navbar-inverse">
                <li class=<?php echo (isset($onLoginPage) && ($onLoginPage == true) ? 'active' : '') ?>>
                    <a href="index.php?controller=user&action=login_page">
                        <?php echo strtoupper( "se connecter" ); ?>
                    </a>
                </li>
                <li class=<?php echo (isset($onRegistration)&& ($onRegistration==true) ? 'active' : '') ?>>
                    <a href="index.php?controller=user&action=registration_page">
                        <?php echo strtoupper( "s'inscrire" ); ?>
                    </a>
                </li>
                <li class=<?php echo (isset($onPasswordForgotten) && ($onPasswordForgotten == true) ? 'active' : '') ?>>
                    <a href="index.php?controller=user&action=pwd_forgotten">
                        <?php echo strtoupper( "mot de passe oublie" ); ?>
                    </a>
                </li>

            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

1 个答案:

答案 0 :(得分:0)

如果工作版本和损坏版本之间的HTML标记相同,我会检查:

1)将bootstrap javascript加载到页面上(在开发人员工具的网络选项卡中);和 2)开发人员工具控制台中没有可能影响页面上其他JS的javascript错误