Bootstrap 3 Hide Dropdown Menu on Menu Item Click

后端 未结 6 1072
眼角桃花
眼角桃花 2021-02-04 07:05

Check out the fiddle. I have a basic Bootstrap 3 responsive nav like so:

    
&
6条回答
  •  鱼传尺愫
    2021-02-04 07:53

    If you wanted to do this without JavaScript you could simply add the data-target and data-toggle to each list item, like so:

  • Option 1
  • Option 2
  • Option 3
  • For the navbar, this really only works in the mobile view mode when there is a toggle button. Strange things happen when the navbar is exposed (the toggle button isn't showing).

提交回复
热议问题