css实现水滴式开关效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现水滴式开关效果代码

代码标签: css 水滴 开关

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <style>
        body {
	background:#333
}
.gp-header {
	font-family:georgia;
	font-size:40px;
	color:#5fd698;
	font-style:italic;
	text-align:center;
	margin-top:25px
}
.gp-footer {
	position:fixed;
	color:rgba(95,214,152,0.7);
	bottom:10px;
	left:50%;
	font-family:georgia;
	font-style:italic;
	transform:translateX(-50%)
}
.gp-footer .soc_icons {
	display:inline-block;
	color:#5fd698;
	margin:0 10px
}
::-moz-selection {
	background:transparent
}
::selection {
	background:transparent
}
.switchContainer {
	display:inline-block;
	filter:url("index.html#gooey");
	-webkit-filter:url("#gooey");
	position:absolute;
	left:50%;
	top:50%;
	cursor:pointer;
	transform:translate(-50%,-50%) scale(2)
}
.switchBg {
	width:60px;
	height:7px
}
.switchBtn {
	width:30px;
	height:30px;
	border-radius:50%;
	display:inline-block;
	position:absolute;
	left:0;
	top:-12px;
	transform:translate3d(0,0,0)
}
.switchBg,.switchBtn {
	background:#fff;
	transition:300ms all ease
}
.switchContainer.switchOn .switchBtn,.switchContainer.switchOn .switchBg {
	background:#5fd698
}
.switchContainer.switchOn .switchBtn {
	animation:switchOn 250ms linear forwards
}
.switchContainer.switchOff .switchBtn {
	animation:switchOff 250ms linear forwards
}
@keyframes switchOn {
	0% {
	transform:scale3d(1,1,1) translate3d(0px,0,0);
	transform-origin:left center
}
40% {
	transform:scale3d(1.4,0.7,0) translate3d(20px,0,0);
	transform-origin:right center
}
70% {
	transform:scale3d(0.9,1.15,1) tran.........完整代码请登录后点击上方下载按钮下载查看

网友评论0