Twitter Bootstrap Accordion and button dropdown overflow issue

前端 未结 10 1794
一个人的身影
一个人的身影 2021-02-12 12:25

I\'m using Bootstrap for a section of my website. I mix accordion with a dropdown button. The problem comes when the button is on the bottom, the drop-down is hidden since the .

10条回答
  •  Happy的楠姐
    2021-02-12 12:49

    I know I'm seven months late to this party, but maybe someone else will find this helpful.

    The cleanest solution I've found to this problem is to use the Bootstrap event handlers on the accordion. It's still kind of kludgy, but IMO it's less hackish than the accepted answer by ScottS (which I think would be better if not for the behavior in Chrome).

    $(document).ready(function() {
      $('.accordion-body').on('shown', function() {
        $(this).css('overflow', 'visible');
      });
      $('.accordion-body').on('hide', function() {
        $(this).css('overflow', 'hidden');
      });
    });
    

提交回复
热议问题