progressbutton实现不同样式带有进度的按钮点击动画效果代码
代码语言:html
所属分类:表单美化
代码描述:progressbutton实现不同样式带有进度的按钮点击动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { color: #fff; font-family: 'Lato', Arial, sans-serif; background-color: #EFEFEF; } .clearfix:before, .clearfix:after { content: ''; display: table; } .clearfix:after { clear: both; } a { color: #148544; text-decoration: none; outline: none; } a:hover, a:focus { color: #fff; } .container > header { margin: 0 auto 2em; padding: 2em; text-align: center; background: rgba(0,0,0,0.01); } .container > header h1 { font-size: 3.5em; line-height: 1.3; margin: 0; font-weight: 300; } .container > header span { display: block; font-size: 60%; color: #148544; padding: 0.3em 0 0.6em 0.1em; } .note { color: #85cd62; } /* To Navigation Style */ .codrops-top { text-transform: uppercase; width: 100%; font-size: 0.69em; line-height: 2.2; font-weight: 700; } .codrops-top a { text-decoration: none; padding: 0 1em; letter-spacing: 0.1em; display: inline-block; } .codrops-top span.right { float: right; } .codrops-top span.right a { float: left; display: block; } .codrops-icon:before { font-family: 'codropsicons'; margin: 0 4px; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; } .codrops-icon-drop:before { content: "\e001"; } .codrops-icon-prev:before { content: "\e004"; } .wrapper { text-align: center; vertical-align: top; } section { position: relative; text-align: center; padding: 1em 1em 3em; } .wrapper section { display: inline-block; width: 300px; } section h2 { text-transform: uppercase; letter-spacing: 1px; color: #148544; font-weight: 700; padding: 1em; font-size: 0.8em; -webkit-backface-visibility: hidden; } .related { font-size: 2em; font-weight: 300; } @media screen and (max-width: 25em) { .container > header { font-size: 70%; } .related { font-size: 120%; } .codrops-icon span { display: none; } } *, *:after, *::before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } /* General styles for all types of buttons */ .progress-button { position: relative; display: inline-block; padding: 0 60px; outline: none; border: none; background: #1d9650; color: #fff; text-transform: uppercase; letter-spacing: 1px; font-size: 1em; line-height: 4; } .progress-button[disabled], .progress-button[disabled].state-loading { cursor: default; } .progress-button .content { position: relative; display: block; } .progress-button .content::before, .progress-button .content::after { position: absolute; right: 20px; color: #0e7138; font-family: "icomoon"; opacity: 0; -webkit-transition: opacity 0.3s 0.3s; transition: opacity 0.3s 0.3s; } .progress-button .content::before { content: "\e600"; /* Checkmark for success */ } .progress-button .content::after { content: "\e601"; /* Cross for error */ } .progress-button.state-success .content::before, .progress-button.state-error .content::after { opacity: 1; } .notransition { -webkit-transition: none !important; transition: none !important; } .progress-button .progress { background: #148544; } .progress-button .progress-inner { position: absolute; left: 0; background: #0e7138; } .progress-button[data-horizontal] .progress-inner { top: 0; width: 0; height: 100%; -webkit-transition: width 0.3s, opacity 0.3s; transition: width 0.3s, opacity 0.3s; } .progress-button[data-vertical] .progress-inner { bottom: 0; width: 100%; height: 0; -webkit-transition: height 0.3s, opacity 0.3s; transition: height 0.3s, opacity 0.3s; } /* Necessary 3d styles for buttons with perspective */ .progress-button[data-perspective] { position: relative; display: inline-block; padding: 0; background: transparent; -webkit-perspective: 900px; perspective: 900px; } .progress-button[data-perspective] .content { padding: 0 60px; background: #1d9650; } .progress-button[data-perspective] .progress-wrap { display: block; -webkit-transition: -webkit-transform 0.2s; transition: transform 0.2s; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .progress-button[data-perspective] .content, .progress-button[data-perspective] .progress { outline: 1px solid rgba(0,0,0,0); /* Smoothen jagged edges in FF */ } /* Individual styles */ /* Choose the effect(s) you want, delete the rest */ /* Fill horizontal */ /* ====================== */ .progress-button[data-style="fill"][data-horizontal] { overflow: hidden; } .progress-button[data-style="fill"][data-horizontal] .content { z-index: 10; -webkit-transition: -webkit-transform 0.3s; transition: transform 0.3s; } .progress-button[data-style="fill"][data-horizontal] .content::before, .progress-button[data-style="fill"][data-horizontal] .content::after { top: 100%; right: auto; left: 50%; -webkit-transition: opacity 0.3s; transition: opacity 0.3s; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .progress-button[data-style="fill"][data-horizontal].state-success .content, .progress-button[data-style="fill"][data-horizontal].state-error .content { -webkit-transform: translateY(-100%); transform: translateY(-100%); } /* Fill vertical */ /* ====================== */ .progress-button[data-style="fill"][data-vertical] { overflow: hidden; } .progress-button[data-style="fill"][data-vertical] .content { z-index: 10; -webkit-transition: -webkit-transform 0.3s; transition: transform 0.3s; } .progress-button[data-style="fill"][data-vertical] .content::before, .progress-button[data-style="fill"][data-vertical] .content::after { top: 100%; right: auto; left: 50%; -webkit-transition: opacity 0.3s; transition: opacity 0.3s; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .progress-button[data-style="fill"][data-vertical].state-success .content, .progress-button[data-style="fill"][data-vertical].state-error .content { -webkit-transform: translateY(-100%); transform: translateY(-100%); } /* Shrink horizontal */ /* ====================== */ .progress-button[data-style="shrink"] { /* common for horizontal and vertical */ overflow: hidden; -webkit-transition: -webkit-transform 0.2s; transition: transform 0.2s; } .progress-button[data-style="shrink"][data-horizontal] .content { -webkit-transition: opacity 0.3s, -webkit-transform 0.3s; transition: opacity 0.3s, transform 0.3s; } .progress-button[data-style="shrink"][data-horizontal] .content::before, .progress-button[data-style="shrink"][data-horizontal] .content::after { top: 100%; right: auto; left: 50%; -webkit-transition: opacity 0.3s; transition: opacity 0.3s; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .progress-button[data-style="shrink"][data-horizontal].state-loading { -webkit-transform: scaleY(0.3); transform: scaleY(0.3); } .progress-button[data-style="shrink"][data-horizontal].state-loading .content { opacity: 0; } .progress-button[data-style="shrink"][data-horizontal].state-success .content, .progress-button[data-style="shrink"][data-horizontal].state-error .content { -webkit-transform: translateY(-100%); transform: translateY(-100%); } /* Shrink vertical */ /* ====================== */ .progress-button[data-style="shrink"][data-vertical] .content { -webkit-transition: opacity 0.3s, -webkit-transform 0.3s; transition: opacity 0.3s, transform 0.3s; } .progress-button[data-style="shrink"][data-vertical] .content::before, .progress-button[data-style="shrink"][data-vertical] .content::after { top: 100%; right: auto; left: 50%; -webkit-transition: opacity 0.3s; transition: opacity 0.3s; -webkit-transform: translateX(-50%); transform: translateX(-50%); } .progress-button[data-style="shrink"][data-vertical].state-loading { -webkit-transform: scaleX(0.1); transform: scaleX(0.1); } .progress-button[data-style="shrink"][data-vertical].state-loading .content { opacity: 0; } .progress-button[data-style="shrink"][data-vertical].state-success .content, .progress-button[data-style="shrink"][data-vertical].state-error .content { -webkit-transform: translateY(-100%); transform: translateY(-100%); } /* Rotate bottom 3d */ /* ====================== */ .progress-button[data-style="rotate-angle-bottom"] .progress { position: absolute; top: 100%; left: 0; width: 100%; height: 20px; box-shadow: 0 -1px 0 #148544; /* fix the blurriness that causes a gap */ -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); -webkit-transform-origin: 50% 0%; transform-origin: 50% 0%; } .progress-button[data-style="rotate-angle-bottom"].state-loading .progress-wrap { -webkit-transform: rotateX(45deg); transform: rotateX(45deg); } /* Rotate top 3d */ /* ====================== */ .progress-button[data-style="rotate-angle-top"] .progress { position: absolute; bottom: 100%; left: 0; width: 100%; height: 20px; box-shadow: 0 1px 0 #148544; /* fix the blurriness that causes a gap */ -webkit-transform: rotateX(90deg); transform: rotateX(90deg); -webkit-transform-origin: 50% 100%; transform-origin: 50% 100%; } .progress-button[data-style="rotate-angle-top"].state-loading .progress-wrap { -webkit-transform: rotateX(-45deg); transform: rotateX(-45deg); } /* Rotate left 3d */ /* ====================== */ .progress-button[data-style="rotate-angle-left"] .progress { position: absolute; top: 0; right: 100%; width: 20px; height: 100%; box-shadow: 1px 0 0 #148544; /* fix the blurriness that causes a gap */ -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); -webkit-transform-origin: 100% 50%; transform-origin: 100% 50%; } .progress-button[data-style="rotate-angle-left"].state-loading .progress-wrap { -webkit-transform: rotateY(45deg); transform: rotateY(45deg); } /* Rotate right 3d */ /* ====================== */ .progress-button[data-style="rotate-angle-right"] .progress { position: absolute; top: 0; left: 100%; width: 20px; height: 100%; box-shadow: -1px 0 0 #148544; /* fix the blurriness that causes a gap */ -webkit-transform: rotateY(90deg); transform: rotateY(90deg); -webkit-transform-origin: 0% 50%; transform-origin: 0% 50%; } .progress-button[data-style="rotate-angle-right"].state-loading .progress-wrap { -webkit-transform: rotateY(-45deg); transform: rotateY(-45deg); } /* Rotate side down 3d */ /* ====================== */ .progress-button[data-style="rotate-side-down"] .progress { position: absolute.........完整代码请登录后点击上方下载按钮下载查看
网友评论0