Bootstrap Collapse accordion on hover

前端 未结 7 1976
轮回少年
轮回少年 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条回答
  •  萌比男神i
    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 plane that flies below water
      

提交回复
热议问题