Tab选项卡

扁平化风格滑动Tab选项卡

阿里云

这是一款时下最为流行的 jQuery 和 CSS3 扁平风格滑动面板插件。整个设计风格简洁大方,代码十分简单。当面板打开和关闭时还带有一定图标旋转动画的点缀。

HTML 结构:

该滑动面板使用无序列表制作,HTML 结构非常简单。每个列表项中使用一个 div .info-box-green 作为整个滑动面板的 wrapper。里面的 h4 标签是面板的标题,div.info-content 是面板的内容。最后空的是面板右边显示的"+"号。

也想出现在这里?联系我们
创客主机
  1. <ul class="wrapper">
  2.   <li>
  3.     <div class="info-box-green">
  4.       <h4 class="entypo-tools"> Featured Services </h4>
  5.  
  6.       <div class="info-content">
  7.         <div class="text">
  8.           <p>...</p>
  9.         </div>
  10.         <span class="entypo-plus" id="expand-green"></span>
  11.       </div>
  12.     </div>
  13.   </li>
  14.  
  15.   ...
  16.  
  17. </ul>

CSS 样式:

该滑动面板使用 CSS3 来制作扁平化风格的样式。在面板打开时,面板右边的“+”号还有一个旋转动画,由 CSS3 transform 完成的。

  1. .info-box-green, .info-box-red, .info-box-sky {
  2.   margin: 50px auto;
  3.   padding: 0;
  4.   width: 480px;
  5.   -webkit-box-shadow: 0 8px 6px -6px black;
  6.      -moz-box-shadow: 0 8px 6px -6px black;
  7.           box-shadow: 0 8px 6px -6px black;
  8. }
  9.  
  10. .info-box-red h4 {
  11.   -webkit-border-radius: 10px;
  12.   border-radius: 10px;
  13.   margin-bottom: -10px;
  14. }
  15.  
  16. .info-box-red > .info-content > .text {
  17.  -webkit-border-radius: 0 0 10px 10px;
  18.   border-radius: 0 0 10px 10px; 
  19. }
  20.  
  21. .info-box-green h4, .info-box-green > .info-content > .text {
  22.  background-color: #00AB83;
  23. }
  24.  
  25. .info-box-red h4, .info-box-red > .info-content > .text {
  26.   background-color: #FF434C;
  27. }
  28.  
  29. .info-box-sky h4, .info-box-sky > .info-content > .text {
  30.   background-color: #00A5C3;
  31. }
  32.  
  33. .info-box-green h4, .info-box-red h4, .info-box-sky h4 {
  34.   padding: 25px;
  35.   font-size: 1.125em;
  36.   font-weight: 400;
  37.   color: #FFF;
  38. }
  39.  
  40. .info-box-green > .info-content > .text, .info-box-red > .info-content > .text, .info-box-sky > .info-content > .text {
  41.   padding: 0px;
  42.   font-size: 1em;
  43.   line-height: 1.5em;
  44.   height: 0;
  45.   color: #FFF;
  46.   overflow: hidden;
  47.   -webkit-transition:  height 200ms ease;  
  48.      -moz-transition:  height 200ms ease;  
  49.        -o-transition:  height 200ms ease;  
  50.           transition:  height 200ms ease;
  51. }
  52.  
  53. .info-box-green > .info-content > .text > p, .info-box-red > .info-content > .text > p, .info-box-sky > .info-content > .text > p {
  54.   padding: 20px 20px 60px;
  55. }
  56.  
  57. .info-box-sky > .info-content > .text {
  58.   background-color: #FFF;
  59.   color: #444;
  60.   border-radius: 0;
  61. }
  62.  
  63. .info-box-green > .info-content > .text.open-green, .info-box-red > .info-content > .text.open-red, .info-box-sky > .info-content > .text.open-sky {
  64.   display: block;
  65.   height: auto;
  66. }
  67.  
  68. .info-box-green > .info-content > span.close-green, .info-box-red > .info-content > span.close-red, .info-box-sky > .info-content > span.close-sky {
  69.   -webkit-transform:rotate(135deg);
  70.      -moz-transform:rotate(135deg);
  71.        -o-transform:rotate(135deg);
  72.       -ms-transform:rotate(135deg);
  73. }
  74.  
  75. .info-box-green span, .info-box-red span, .info-box-sky span {
  76.   display: inline-block;
  77.   float: right;
  78.   position: relative;
  79.   bottom: 60px;
  80.   right: 10px;
  81.   margin: 0;
  82.   padding: 10px;
  83.   color: #FFF;
  84.   font-size: 2em;
  85.   cursor: pointer;
  86.   /*  Rotate '+' to 'X' */
  87.   -webkit-transition: all 600ms ease-in-out; 
  88.      -moz-transition: all 600ms ease-in-out; 
  89.        -o-transition: all 600ms ease-in-out; 
  90.       -ms-transition: all 600ms ease-in-out; 
  91.           transition: all 600ms ease-in-out;
  92. }
  93.  
  94. .info-box-sky > .info-content > span.close-sky {
  95.   color: #444;
  96. }
  97.  
  98. .info-box-red span {
  99.   position: relative;
  100.   bottom: 50px;
  101.   right: 10px;
  102. }

JAVASCRIPT 部分:

该滑动面板插件使用 jQuery 来切换样式完成面板的展开和收缩。

  1. <script>
  2.   $('#expand-green').on('click', function () {
  3.       $(this).toggleClass('close-green');
  4.       $('.text').toggleClass('open-green').end();
  5.   });
  6.   $('#expand-red').on('click', function () {
  7.       $(this).toggleClass('close-red');
  8.       $('.text').toggleClass('open-red');
  9.   });
  10.   $('#expand-sky').on('click', function () {
  11.       $(this).toggleClass('close-sky');
  12.       $('.text').toggleClass('open-sky');
  13.   });
  14. </script>

扁平化风格滑动 Tab 选项卡

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

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

发表回复

热销模板

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

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