栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > Html/CSS > CSS教程

一款基于css3和jquery实现的动画显示弹出层按钮教程

CSS教程 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

  今天给大家分享一款基于css3和jquery实现的动画弹出层。这款弹出层初页面面一个显示弹出层按钮。单击该按钮时,弹出层以非常炫的动画形式出现。弹出层有关闭按钮,单击半闭按钮,弹出层关闭。效果图如下:

  实现的代码。

  html代码:

XML/HTML Code复制内容到剪贴板
  1.   
  2.           
  3.           
  4.               
  5.               
  6.         
  
  •           
  •           
  •             

      
  •         
  •   
  •           
  •           
  •             

      
  •         
  •   
  •           
  •           
  •             

      
  •         
  •   
  •       
  •       
  •       
  •   css3代码:

    CSS Code复制内容到剪贴板
    1. @import url("http://daneden.github.io/animate.css/animate.min.css");   
    2.         :root   
    3.         {   
    4.             width: 100%;   
    5.             height: 100%;   
    6.         }   
    7.         body   
    8.         {   
    9.             width: 100%;   
    10.             height: 100%;   
    11.             display: -webkit-flex;   
    12.             display: -ms-flexbox;   
    13.             display: flex;   
    14.             -webkit-align-items: center;   
    15.             -ms-flex-align: center;   
    16.             align-items: center;   
    17.             -webkit-justify-content: center;   
    18.             -ms-flex-pack: center;   
    19.             justify-content: center;   
    20.             overflow: hidden;   
    21.             background-color: #263238;   
    22.         }   
    23.         .papersheet   
    24.         {   
    25.             position: relative;   
    26.             overflow: hidden;   
    27.             text-align: center;   
    28.             -moz-box-sizing: border-box;   
    29.             box-sizing: border-box;   
    30.             -webkit-transition: all 200ms;   
    31.             transition: all 200ms;   
    32.             width: 100%;   
    33.             height: 100%;   
    34.             max-width: 50%;   
    35.             min-width: 50rem;   
    36.             max-height: 50%;   
    37.             min-height: 20rem;   
    38.             margin: 0 auto;   
    39.             display: -webkit-flex;   
    40.             display: -ms-flexbox;   
    41.             display: flex;   
    42.             -webkit-align-items: center;   
    43.             -ms-flex-align: center;   
    44.             align-items: center;   
    45.             -webkit-justify-content: center;   
    46.             -ms-flex-pack: center;   
    47.             justify-content: center;   
    48.         }   
    49.         .papersheet.opened   
    50.         {   
    51.             -webkit-transition: all 900ms;   
    52.             transition: all 900ms;   
    53.             box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.5);   
    54.         }   
    55.         .papersheet__trigger   
    56.         {   
    57.             z-index: 1;   
    58.             display: inline-block;   
    59.             padding: 2rem;   
    60.             border-radius: 50%;   
    61.             position: absolute;   
    62.             background-color: transparent;   
    63.             top: 50%;   
    64.             left: 50%;   
    65.             -webkit-transform: translate(-50%, -50%);   
    66.             -ms-transform: translate(-50%, -50%);   
    67.             transform: translate(-50%, -50%);   
    68.             -webkit-transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);   
    69.             transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);   
    70.             cursor: pointer;   
    71.         }   
    72.         .opened .papersheet__trigger   
    73.         {   
    74.             background-color: #eceff1;   
    75.             top: 10%;   
    76.         }   
    77.         .papersheet__trigger:hover   
    78.         {   
    79.             box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.5);   
    80.         }   
    81.         .papersheet__trigger:active:before   
    82.         {   
    83.             background-color: #d5d5d5;   
    84.         }   
    85.         .papersheet__trigger:before   
    86.         {   
    87.             content: "";   
    88.             background-color: #eceff1;   
    89.             display: block;   
    90.             position: absolute;   
    91.             border-radius: 50%;   
    92.             top: 50%;   
    93.             left: 50%;   
    94.             bottombottom: 50%;   
    95.             rightright: 50%;   
    96.             width: 6rem;   
    97.             height: 6rem;   
    98.             z-index: 0;   
    99.             pointer-events: none;   
    100.             -webkit-transform: translate(-50%, -50%);   
    101.             -ms-transform: translate(-50%, -50%);   
    102.             transform: translate(-50%, -50%);   
    103.             -webkit-transition-delay: 2s;   
    104.             transition-delay: 2s;   
    105.             -webkit-transition: all 400ms cubic-bezier(0.165, 0.84, 0.44, 1);   
    106.             transition: all 400ms cubic-bezier(0.165, 0.84, 0.44, 1);   
    107.         }   
    108.         .opened .papersheet__trigger:before   
    109.         {   
    110.             width: 3000px;   
    111.             height: 3000px;   
    112.             -webkit-transition: all 2.5s cubic-bezier(0.165, 0.84, 0.44, 1);   
    113.             transition: all 2.5s cubic-bezier(0.165, 0.84, 0.44, 1);   
    114.         }   
    115.         .papersheet__trigger-icon  
    116.         {   
    117.             fill: #37474f;   
    118.             vertical-align: bottombottom;   
    119.             -webkit-transform: rotate(45deg);   
    120.             -ms-transform: rotate(45deg);   
    121.             transform: rotate(45deg);   
    122.             -webkit-transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);   
    123.             transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);   
    124.             -webkit-transition-delay: 50ms;   
    125.             transition-delay: 50ms;   
    126.             width: 1.8rem;   
    127.             height: 1.8rem;   
    128.         }   
    129.         .opened .papersheet__trigger-icon  
    130.         {   
    131.             -webkit-transform: rotate(-360deg);   
    132.             -ms-transform: rotate(-360deg);   
    133.             transform: rotate(-360deg);   
    134.         }   
    135.         .papersheet__face-item   
    136.         {   
    137.             border-radius: 50%;   
    138.             margin: 0 1.5rem;   
    139.             z-index: 1;   
    140.             height: 6rem;   
    141.             width: 6rem;   
    142.             display: none;   
    143.             overflow: hidden;   
    144.         }   
    145.         .papersheet__face-item:nth-child(2)   
    146.         {   
    147.             -webkit-animation-delay: 50ms;   
    148.             animation-delay: 50ms;   
    149.         }   
    150.         .papersheet__face-item:nth-child(3)   
    151.         {   
    152.             -webkit-animation-delay: 150ms;   
    153.             animation-delay: 150ms;   
    154.         }   
    155.         .papersheet__face-item:nth-child(4)   
    156.         {   
    157.             -webkit-animation-delay: 250ms;   
    158.             animation-delay: 250ms;   
    159.         }   
    160.         .papersheet__face-item img   
    161.         {   
    162.             max-width: 100%;   
    163.         }   
    164.         .opened .papersheet__face-item   
    165.         {   
    166.             -webkit-transform: translateX(60%);   
    167.             -ms-transform: translateX(60%);   
    168.             transform: translateX(60%);   
    169.             display: block;   
    170.         }  
    转载请注明:文章转载自 www.mshxw.com
    本文地址:https://www.mshxw.com/it/216449.html

    CSS教程相关栏目本月热门文章

    我们一直用心在做
    关于我们 文章归档 网站地图 联系我们

    版权所有 (c)2021-2022 MSHXW.COM

    ICP备案号:晋ICP备2021003244-6号