css3删除功能,仅使用css3删除元素时应用css3动画

Bellow片段会在关闭div时显示您打开的确切动画。





$(document).ready(function() {

$(".container").append($("

Hello Jimmy! X
"));

$(".close").on('click', function() {

$(this).parent().css({

"animation": "close-anime 1s forwards"

});

});

});

.container {

padding: 10px;

background: orange;

}

.child-container {

background: red;

height: 100px;

width: 150px;

padding: 10px;

animation-name: anime;

animation-duration: 1s;

}

.close {

float: right;

cursor: pointer;

}

.close:hover {

color: #fff;

}

/*ANIMATIONS*/

@keyframes anime {

from,

0%,

100%,

to {

animation-timing-function: cubic-bezier(0.25, 0.60, 0.35, 1.00);

}

0% {

opacity: 0;

transform: translate3d(0, -200px, 0);

}

100% {

opacity: 1;

transform: translate3d(0, 0, 0);

}

}

@keyframes close-anime {

from,

0%,

100%,

to {

animation-timing-function: cubic-bezier(0.25, 0.60, 0.35, 1.00);

}

0% {

opacity: 0;

transform: translate3d(0, 0, 0);

}

100% {

opacity: 1;

transform: translate3d(0, -200px, 0);

}

}

添加代码:

的CSS 强>

@keyframes close-anime {

from,

0%,

100%,

to {

animation-timing-function: cubic-bezier(0.25, 0.60, 0.35, 1.00);

}

0% {

opacity: 0;

transform: translate3d(0, 0, 0);

}

100% {

opacity: 1;

transform: translate3d(0, -200px, 0);

}

}

JS 强>

$(this).parent().css({

"animation": "close-anime 1s forwards"

});

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值