How to make with twitter bootstrap tabs on hover instead of clicking?

前端 未结 6 1876
盖世英雄少女心
盖世英雄少女心 2021-01-31 18:36

I finally got Bootstrap tabs to work. I was wondering if there\'s a way to change the behaviour so instead of clicking just hovering the cursor would show the hidden content?

6条回答
  •  爱一瞬间的悲伤
    2021-01-31 19:30

    i hope it is nice solution

    (function ($) {
      $(function () {
        $(document).off('click.bs.tab.data-api', '[data-hover="tab"]');
        $(document).on('mouseenter.bs.tab.data-api', '[data-toggle="tab"], [data-hover="tab"]', function () {
          $(this).tab('show');
        });
      });
    })(jQuery);
    

提交回复
热议问题