Open and close side menu with same button

前端 未结 4 816
耶瑟儿~
耶瑟儿~ 2021-01-24 22:24

Currently I use one button to display a side menu and another to close it



        
4条回答
  •  失恋的感觉
    2021-01-24 23:13

    Just make a class to show the menu and toggle this class on button click...!

    $('#open-menu').click(function() {
      $("#mySidenav").toggleClass('show')
    });
    #mySidenav {background: red; height: 100px; display: none;}
    .show {display: block !important;}
    
    

提交回复
热议问题