CSS3半透明垂直Accordion手风琴选项卡特效

创客云


这是一款jquery和CSS3半透明垂直Accordion特效。该Accordion基于bootstrap手风琴插件,通过简单的CSS样式,来对其进行美化。

使用方法

在页面中引入下面的文件。

  1. <link rel="stylesheet" href="http://jrain.oscitas.netdna-cdn.com/tutorial/css/fontawesome-all.min.css">
  2. <link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  3. <script src="js/jquery.min.js" type="text/javascript"></script>
  4. <script src="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

HTML结构

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-offset-3 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 role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
  9.                                 Section 1
  10.                             </a>
  11.                         </h4>
  12.                     </div>
  13.                     <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
  14.                         <div class="panel-body">
  15.                             <p>Lorem ipsum dolor sit amet,... </p>
  16.                         </div>
  17.                     </div>
  18.                 </div>
  19.  
  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" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  24.                                 Section 2
  25.                             </a>
  26.                         </h4>
  27.                     </div>
  28.                     <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
  29.                         <div class="panel-body">
  30.                             <p>Lorem ipsum dolor sit amet,...</p>
  31.                         </div>
  32.                     </div>
  33.                 </div>
  34.  
  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" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
  39.                                 Section 3
  40.                             </a>
  41.                         </h4>
  42.                     </div>
  43.                     <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
  44.                         <div class="panel-body">
  45.                             <p>Lorem ipsum dolor sit amet, ...</p>
  46.                         </div>
  47.                     </div>
  48.                 </div>
  49.             </div>
  50.         </div>
  51.     </div>
  52. </div>

CSS样式

  1. a:hover,a:focus{
  2.         text-decoration: none;
  3.         outline: none;
  4.     }
  5.     #accordion .panel{
  6.         border: none;
  7.         border-radius: 5px;
  8.         box-shadow: none;
  9.         margin-bottom: 10px;
  10.         background: transparent;
  11.     }
  12.     #accordion .panel-heading{
  13.         padding: 0;
  14.         border: none;
  15.         border-radius: 5px;
  16.         background: transparent;
  17.         position: relative;
  18.     }
  19.     #accordion .panel-title a{
  20.         display: block;
  21.         padding: 20px 30px;
  22.         margin: 0;
  23.         background: rgba(0,0,0,0.4);
  24.         font-size: 17px;
  25.         font-weight: bold;
  26.         color: #fff;
  27.         text-transform: uppercase;
  28.         letter-spacing: 1px;
  29.         border: none;
  30.         border-radius: 5px;
  31.         position: relative;
  32.     }
  33.     #accordion .panel-title a.collapsed{ border: none; }
  34.     #accordion .panel-title a:before,
  35.     #accordion .panel-title a.collapsed:before{
  36.         content: "\f107";
  37.         font-family: "Font Awesome 5 Free";
  38.         width: 30px;
  39.         height: 30px;
  40.         line-height: 27px;
  41.         text-align: center;
  42.         font-size: 25px;
  43.         font-weight: 900;
  44.         color: #fff;
  45.         position: absolute;
  46.         top: 15px;
  47.         right: 30px;
  48.         transform: rotate(180deg);
  49.         transition: all .4s cubic-bezier(0.080, 1.090, 0.320, 1.275);
  50.     }
  51.     #accordion .panel-title a.collapsed:before{
  52.         color: rgba(255,255,255,0.5);
  53.         transform: rotate(0deg);
  54.     }
  55.     #accordion .panel-body{
  56.         padding: 20px 30px;
  57.         background: rgba(0,0,0,0.1);
  58.         font-size: 15px;
  59.         color: #fff;
  60.         line-height: 28px;
  61.         letter-spacing: 1px;
  62.         border-top: none;
  63.         border-radius: 5px;
  64.     }
演示地址 免费下载
本文由 CityMall 整理发布如需转载,请注明出处:https://www.22vd.com/48421.html
云模板

发表评论