Bootstrap 3: how to make head of dropdown link clickable in navbar

前端 未结 15 841
暗喜
暗喜 2020-12-07 09:23

I\'m using the default navbar and a couple of the list items are dropdowns. I\'m not able to click the link that triggers the dropdown. I know that I could just add a duplic

15条回答
  •  [愿得一人]
    2020-12-07 10:22

    Here is my solution which uses JQuery in your header, and works on Mobile.

    On mobile the top links require two taps: one to dropdown the menu and one to go to its link.

    $(function(){
      $('.dropdown-toggle').click(
        function(){
          if ($(this).next().is(':visible')) {
            location.href = $(this).attr('href');;
          }
         });
      });
    });

提交回复
热议问题