首页 技术 正文
技术 2022年11月7日
0 收藏 418 点赞 526 浏览 5110 个字

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

一款基于css3和jquery实现的动画弹出层

在线预览   源码下载

实现的代码。

html代码:

   <div class="papersheet">
<!-- Action Trigger -->
<div class="papersheet__trigger">
<!-- Icon -->
<svg class="papersheet__trigger-icon" viewbox="0 0 24 24"><g transform="scale(0.023 0.023)"><path d="M1014.662 822.66c-0.004-0.004-0.008-0.008-0.012-0.010l-310.644-310.65 310.644-310.65c0.004-0.004 0.008-0.006 0.012-0.010 3.344-3.346 5.762-7.254 7.312-11.416 4.246-11.376 1.824-24.682-7.324-33.83l-146.746-146.746c-9.148-9.146-22.45-11.566-33.828-7.32-4.16 1.55-8.070 3.968-11.418 7.31 0 0.004-0.004 0.006-0.008 0.010l-310.648 310.652-310.648-310.65c-0.004-0.004-0.006-0.006-0.010-0.010-3.346-3.342-7.254-5.76-11.414-7.31-11.38-4.248-24.682-1.826-33.83 7.32l-146.748 146.748c-9.148 9.148-11.568 22.452-7.322 33.828 1.552 4.16 3.97 8.072 7.312 11.416 0.004 0.002 0.006 0.006 0.010 0.010l310.65 310.648-310.65 310.652c-0.002 0.004-0.006 0.006-0.008 0.010-3.342 3.346-5.76 7.254-7.314 11.414-4.248 11.376-1.826 24.682 7.322 33.83l146.748 146.746c9.15 9.148 22.452 11.568 33.83 7.322 4.16-1.552 8.070-3.97 11.416-7.312 0.002-0.004 0.006-0.006 0.010-0.010l310.648-310.65 310.648 310.65c0.004 0.002 0.008 0.006 0.012 0.008 3.348 3.344 7.254 5.762 11.414 7.314 11.378 4.246 24.684 1.826 33.828-7.322l146.746-146.748c9.148-9.148 11.57-22.454 7.324-33.83-1.552-4.16-3.97-8.068-7.314-11.414z"></path></g></svg>
</div>
<!-- Face 1 -->
<div class="papersheet__face-item animated fadeInUp">
<img src="128.jpg" alt="" />
</div>
<!-- Face 2 -->
<div class="papersheet__face-item animated fadeInUp">
<img src="129.jpg" alt="" />
</div>
<!-- Face 2 -->
<div class="papersheet__face-item animated fadeInUp">
<img src="130.jpg" alt="" />
</div>
</div>
<script src='jquery.js'></script>
<script>
_papersheet = $('.papersheet');
_trigger = $('.papersheet__trigger');
_trigger.click(function () {
if (_papersheet.hasClass('opened')) {
$(this).parent('.papersheet').stop().removeClass('opened');
} else {
$(this).parent('.papersheet').stop().addClass('opened');
}
});
//@ sourceURL=pen.js
</script>

css3代码:

  @import url("http://daneden.github.io/animate.css/animate.min.css");
:root
{
width: 100%;
height: 100%;
}
body
{
width: 100%;
height: 100%;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
overflow: hidden;
background-color: #263238;
}
.papersheet
{
position: relative;
overflow: hidden;
text-align: center;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: all 200ms;
transition: all 200ms;
width: 100%;
height: 100%;
max-width: 50%;
min-width: 50rem;
max-height: 50%;
min-height: 20rem;
margin: 0 auto;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.papersheet.opened
{
-webkit-transition: all 900ms;
transition: all 900ms;
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.5);
}
.papersheet__trigger
{
z-index:;
display: inline-block;
padding: 2rem;
border-radius: 50%;
position: absolute;
background-color: transparent;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);
cursor: pointer;
}
.opened .papersheet__trigger
{
background-color: #eceff1;
top: 10%;
}
.papersheet__trigger:hover
{
box-shadow: 0px 5px 20px rgba(0, 0, 0, 0.5);
}
.papersheet__trigger:active:before
{
background-color: #d5d5d5;
}
.papersheet__trigger:before
{
content: "";
background-color: #eceff1;
display: block;
position: absolute;
border-radius: 50%;
top: 50%;
left: 50%;
bottom: 50%;
right: 50%;
width: 6rem;
height: 6rem;
z-index:;
pointer-events: none;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transition-delay: 2s;
transition-delay: 2s;
-webkit-transition: all 400ms cubic-bezier(0.165, 0.84, 0.44, 1);
transition: all 400ms cubic-bezier(0.165, 0.84, 0.44, 1);
}
.opened .papersheet__trigger:before
{
width: 3000px;
height: 3000px;
-webkit-transition: all 2.5s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: all 2.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.papersheet__trigger-icon
{
fill: #37474f;
vertical-align: bottom;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);
transition: all 800ms cubic-bezier(0.19, 1, 0.22, 1);
-webkit-transition-delay: 50ms;
transition-delay: 50ms;
width: 1.8rem;
height: 1.8rem;
}
.opened .papersheet__trigger-icon
{
-webkit-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
transform: rotate(-360deg);
}
.papersheet__face-item
{
border-radius: 50%;
margin: 0 1.5rem;
z-index:;
height: 6rem;
width: 6rem;
display: none;
overflow: hidden;
}
.papersheet__face-item:nth-child(2)
{
-webkit-animation-delay: 50ms;
animation-delay: 50ms;
}
.papersheet__face-item:nth-child(3)
{
-webkit-animation-delay: 150ms;
animation-delay: 150ms;
}
.papersheet__face-item:nth-child(4)
{
-webkit-animation-delay: 250ms;
animation-delay: 250ms;
}
.papersheet__face-item img
{
max-width: 100%;
}
.opened .papersheet__face-item
{
-webkit-transform: translateX(60%);
-ms-transform: translateX(60%);
transform: translateX(60%);
display: block;
}

via:http://www.w2bc.com/Article/12697

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,957
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,480
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,327
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,110
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,742
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,776