1

我目前在我的 bootstrap3 站点中使用一个名为“Slick-App-Like-Sliding-Menu-Plugin-With-jQuery-Mmenu”的抽屉式菜单,并带有一个登录按钮 - 它调用了一个模式。但是,该模式在此菜单中不起作用。只要它位于光滑菜单之外,它就可以正常工作

知道如何解决吗?我插入了 elseif 部分,但它所做的只是破坏菜单 - 但从好的方面来说,模态有效..

<script type="text/javascript">
    $(document).ready(function() {
    var $menu = $('nav#menu'),
        $html = $('html, body');       
        $menu.mmenu({
            onClick: {
                //  set the location.href after the menu closes
                setLocationHref: function()
                {
                    var href = $(this).attr( 'href' );
                    //  set location.href only if the clicked link is not linked to an anchor
                    return href.slice( 0, 1 ) != '#';
                },

                //  callback after the menu closes
                callback: function()
                {
                    var href = $(this).attr( 'href' );

                    //  if the clicked link is linked to an anchor, scroll the page to that anchor 
                    if ( href.slice( 0, 1 ) == '#' )
                    {
                        setTimeout(
                        function()
                        {
                            $html.animate({
                                scrollTop: $( href ).offset().top
                            }); 
                        }, 10
                    );              
                    }
                    elseif (href.match(/#modalSignin/))
                    {
                        $(href).modal('toggle');
                    }
                }
            },
            configuration: {
                hardwareAcceleration: false
            }
        });
    });
</script>
4

1 回答 1

2

因为我的评论似乎解决了问题,所以我用它来回答

据我所知,在 JS 中你只使用“普通”elseif语句,没有调用语句elseif(其他语言有类似的东西,例如elseif在 PHP 或elifPython 中)。所以基本上你需要一个空格else if,而不是elseif.

于 2013-10-09T02:30:42.007 回答