Twitter Bootstrap mobile nav: hide menu after clicking menu link

后端 未结 7 852
悲&欢浪女
悲&欢浪女 2020-12-15 05:56

I\'m looking for a way to make the Twitter Bootstrap mobile/tablet nav automatically hide/collapse after clicking a menu link. I have a lot of menu items and so when users e

7条回答
  •  悲&欢浪女
    2020-12-15 06:16

    In case anyone else is interested, I found a solution elsewhere. It's beautifully simple.

    Add this id to your markup:

    And add this to your JS:

    $('#hideonclick a').click(function (e) {
                    e.preventDefault();
                    $(this).tab('show');
                    if ($('.btn').is(":visible"))
                        $('.btn').click();
                });
    

提交回复
热议问题