加入收藏 | 设为首页 | 会员中心 | 我要投稿 焦作站长网 (https://www.0391zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 系统 > 正文

DIV点击折叠实例代码

发布时间:2020-03-14 21:05:01 所属栏目:系统 来源:站长网
导读:本文给大家带来一段核心代码关于div点击折叠效果,代码简单易懂,有需要的朋友可以参考下

                        $('.menu .item').removeClass('active');   

                        $(this).parent('.item').addClass('active');                           

                        flag=false;   

                    }else{   

                        $(this).parent('.item').removeClass('active');   

                        flag=true;   

                    }   

                });   

            });   

            $('.menu .item ul li').each(function(){       

                var flag=true;               

                $(this).on('click',function(event){   

                    event.preventDefault();   

                    event.stopPropagation();   

                    if(flag){   

                        $('.menu ul li').removeClass('active');   

                        $(this).addClass('active');   

                        flag=false;   

                    }else{   

                        $(this).removeClass('active');   

                        flag=true;   

                    }                                   

                });   

            });   

        });   

    </script>   

</body>   

</html>  

(编辑:焦作站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读