单击时隐藏移动菜单中的图标栏

时间:2016-04-07 07:32:00

标签: jquery css twitter-bootstrap

enter image description here

点击图标栏后,我试图隐藏图标栏以显示子菜单。

现在,如果我点击它,它会在右侧移动,但它不应该显示在这一侧。

代码

<div class="navbar navbar-inverse">
    <div id="mainmenutop" class="megamenu" role="navigation">
        <div class="navbar">
        <a href="javascript:;" data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
         </a> 

        <div class="collapse navbar-collapse navbar-ex1-collapse">          
        <ul class="nav navbar-nav megamenu megamenu-mobile-active-chk" style="background:#fff !important;">
            <li>
            <img style="width: 140px; margin: 5px 60px !important;" src="<?php echo $this->getSkinUrl('images/Untitled-1.jpg'); ?>"/>
            </li>
        </ul>
        <ul class="nav navbar-nav megamenu megamenu-mobile-active-chk" style="margin:17px; border-bottom: 0px !important;margin-bottom:1px;">               
            <li style="color:#ffea00;">
                Welcome!
            </li>
            <li>

的js

jQuery(document.body).on('dblclick', '#mainmenutop [data-toggle="dropdown"]' ,function(event){
    event.stopImmediatePropagation();
    jQuery(this).parent().show();
    if(!jQuery(this).parent().hasClass('open') && this.href && this.href != '#'){
        window.location.href = this.href;
    }

});

1 个答案:

答案 0 :(得分:0)

jQuery(document.body).on('dblclick', '#mainmenutop [data-toggle="dropdown"]' ,function(event)
{
    event.stopImmediatePropagation();
    jQuery(this).parent().show();
    ('.icon-bar').hide();
    if(!jQuery(this).parent().hasClass('open') && this.href && this.href != '#'){
        window.location.href = this.href;
    }
});