手风琴

美观实用Bootstrap垂直手风琴特效

阿里云


这是一款基于 Bootstrap 的垂直手风琴特效。该手风琴特效基于 Bootstrap Accordion 组件来制作,通过自定义 CSS 样式,生成美观大方的垂直手风琴效果。

使用方法:

在页面中引入 jquery,Bootstrap 的相关文件,以及 FontAwesome 字体图标文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
  2. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  3. <script src="js/jquery.min.js"></script>
  4. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

HTML 结构:

该手风琴效果的基本 HTML 结构如下:

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-6">
  4.             <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  5.                 <div class="panel panel-default">
  6.                     <div class="panel-heading" role="tab" id="headingOne">
  7.                         <h4 class="panel-title">
  8.                             <a class="" role="button" data-toggle="collapse"
  9.                                 data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
  10.                                 Section 1
  11.                             </a>
  12.                         </h4>
  13.                     </div>
  14.                     <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
  15.                         <div class="panel-body">
  16.                             ......
  17.                         </div>
  18.                     </div>
  19.                 </div>
  20.                 <div class="panel panel-default">
  21.                     <div class="panel-heading" role="tab" id="headingTwo">
  22.                         <h4 class="panel-title">
  23.                             <a class="collapsed" role="button" data-toggle="collapse"
  24.                                 data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  25.                                 Section 2
  26.                             </a>
  27.                         </h4>
  28.                     </div>
  29.                     <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
  30.                         <div class="panel-body">
  31.                             ......
  32.                         </div>
  33.                     </div>
  34.                 </div>
  35.                 <div class="panel panel-default">
  36.                     <div class="panel-heading" role="tab" id="headingThree">
  37.                         <h4 class="panel-title">
  38.                             <a class="collapsed" role="button" data-toggle="collapse"
  39.                                 data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
  40.                                 Section 3
  41.                             </a>
  42.                         </h4>
  43.                     </div>
  44.                     <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
  45.                         <div class="panel-body">
  46.                            ......
  47.                         </div>
  48.                     </div>
  49.                 </div>
  50.             </div>
  51.         </div>
  52.     </div>
  53. </div>

CSS 样式:

实现该手风琴效果的 CSS 样式也非常简单:通过简单的边框修饰和 FontAwesome 字体图标来美化手风琴。

  1. a:hover, a:focus{
  2.     outline: none;
  3.     text-decoration: none;
  4. }
  5. #accordion .panel{
  6.     box-shadow: none;
  7.     border: none;
  8.     border-radius:0;
  9.     margin-bottom: 6px;
  10.     border-left:5px solid #944f95;
  11. }
  12. #accordion .panel-heading{
  13.     padding:0;
  14.     background-color:#fff;
  15. }
  16. #accordion .panel-title a{
  17.     display: block;
  18.     color: #333;
  19.     font-size: 15px;
  20.     font-weight: bold;
  21.     padding: 14px 40px;
  22.     background: #f5f5f5;
  23.     text-transform: uppercase;
  24.     border-bottom: 1px solid #d3d3d3;
  25.     position: relative;
  26. }
  27. #accordion .panel-title a.collapsed{
  28.     border-top: 0;
  29.     color: #333;
  30.     background: #eee;
  31.     border-bottom:1px solid transparent;
  32. }
  33. #accordion .panel-title a:before,
  34. #accordion .panel-title a.collapsed:before{
  35.     content: "\f068";
  36.     font-family: FontAwesome;
  37.     position: absolute;
  38.     top: 10px;
  39.     left: 15px;
  40.     font-size: 14px;
  41.     line-height: 24px;
  42.     color: #944f95;
  43. }
  44. #accordion .panel-title a.collapsed:before{
  45.     content: "\f067";
  46. }
  47. #accordion .panel-body{
  48.     color: #666464;
  49.     font-size: 14px;
  50.     line-height: 20px;
  51.     border-top: 0 none;
  52.     background: #eee;
  53.     padding: 15px 27px;
  54. }

美观实用 Bootstrap 垂直手风琴特效

已有 389 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!