Bootstrap Collapse accordion on hover

前端 未结 7 1955
轮回少年
轮回少年 2020-12-16 17:40

I\'m using Twitter\'s Bootstrap \'Collapse\' plug-in in a project I am working on. I have a simple accordion (setup as per the documentation), but I want to amend the defaul

相关标签:
7条回答
  • 2020-12-16 18:22
    1. Add the following script

      $( ".hoverExpand" ).hover(
          function() {
              if (! $(this).hasClass('collapsing') && 
                  $(this).hasClass('collapsed')) {
                      $( this ).click();
              }
          }, function() {
              if  (! $(this).hasClass('collapsing') || 
                   ! $(this).hasClass('collapsed')) {
                      $( this ).click();
              }
          }
      );
      
    2. Add hoverExpand (or whatever you want to call it) to the element. See example below

      <a class="hoverExpand" data-toggle="collapse" data-parent="#accordion" 
         href="#collapseOne">A plane that flies below water</a>
      
    0 讨论(0)
提交回复
热议问题