美文网首页
点击页面空白关闭下拉框

点击页面空白关闭下拉框

作者: 新篇章 | 来源:发表于2017-10-12 11:17 被阅读0次
    <header>
        <nav class="clearfix">
            <h1 class="fl">            
                ![](images/logo.png)            
            </h1>
            <div class="nav-r fl">
                <p id="mainPageUserMenu" style="background:url(images/blackdown.png) right center no-repeat" class="visitor fr">未登录</p>
                <script>
                    $(function(){
                        $("#mainPageUserMenu").click(function(event){
                            event.stopPropagation();
                            if($('.subMenu').css("display") == "none"){
                                $('.subMenu').show();
                            }else{
                                $('.subMenu').hide();
                            }
                        });
                        <!-- 点击页面关闭下拉框-->
                        $(document).on("click",function(){
                            $('.subMenu').hide();
                        });
    
                        $(document).on("click",".visitor",function(event){
                            event.stopPropagation();
                            $('.subMenu').show();
                        });
    
                        $(document).on("click",".subMenu",function(event){
                            event.stopPropagation();
                        });
                    });
    
    
    
    
                </script>
                <ul class="subMenu fr" style="position: relative;list-style: none; top:50px;right:-100px;">
                    <li class="myCount"><a href="javascript:navCommon.MyAccountBtnFunc()">我的账户</a></li>
    
                    <li class="loginOut fll"><a href="javascript:navCommon.LoginOutBtnFunc()">退出登录</a></li>
                </ul>
            </div>
        </nav>
    </header>
    

    相关文章

      网友评论

          本文标题:点击页面空白关闭下拉框

          本文链接:https://www.haomeiwen.com/subject/vmpnyxtx.html