Toggle a simple navigation in Javascript

前端 未结 3 696
时光取名叫无心
时光取名叫无心 2021-01-28 05:24

I want to have a very simple navigation menu. It has to be clickable. So when using this code

3条回答
  •  无人共我
    2021-01-28 05:57

    Why not simplify it to:

    $("#navBtn").click(function() {
      $("#navContent").toggle();
    });
    #navContainer {
      position: relative;
      display: inline-block;
    }
    
    #navContent {
      display: none;
    }
    
    #navContent button {
      display: block;
    }
    
    
    
    
      
    
    

提交回复
热议问题