js+css实现三维翻转的表单效果代码
代码语言:html
所属分类:表单美化
代码描述:js+css实现三维翻转的表单效果代码,结合nouislider实现了滑块拖动和checkbox选中效果。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.3.6.0.js"></script> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/nouislider.11.0.0.css"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/nouislider.11.0.0.js"></script> <style> @charset "UTF-8"; @import url("https://fonts.googleapis.com/css?family=Lato"); html { display: flex; overflow: hidden; } body { margin: auto; } .pen-description { margin-bottom: 30px; text-align: center; } .pen-description .summary { margin-bottom: 10px; } .pen-description .note { color: #555; font-size: 0.85rem; } * { box-sizing: border-box; margin: 0; padding: 0; } .clearfix { overflow: auto; } .noUi-horizontal.noUi-extended .noUi-handle { outline: 0 none; } .option { overflow-x: hidden; } .center { display: table; margin: 0 auto; text-align: center; } .link { border: 0 none; color: #1E76D7; cursor: pointer; font-size: 15px; font-weight: 400; padding: 0; text-transform: none; } .link:hover, .link:active { background-color: transparent; color: #185daa; } html, body { min-height: 100%; } body * { font-family: "Lato"; } body { background: #e9ecf3; -webkit-text-size-adjust: 100%; font-family: "Lato", sans-serif; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; } input { -webkit-appearance: none; } /*** form element partial ***/ .example-container { background-color: #fff; border: 1px solid #e6e6e6; border-radius: 5px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); padding: 15px; width: 400px; } .example-backup { display: none; height: 320px; width: 360px; } .example-backup .title { margin-bottom: 30px; padding-top: 50px; } .step-number { color: #1E76D7; font-size: 13px; font-weight: 600; padding-right: 7px; } .step-number:after { content: ""; border-right: 1px solid #cdcdcd; padding-right: 10px; } .step-name { color: #888888; font-size: 12px; } .icon { text-indent: -9999px; position: relative; display: inline-block; } [data-icon=close] { cursor: pointer; margin-right: -15px; margin-top: -15px; width: 35px; padding: 10px; } [data-icon=close]:hover:before { opacity: 0.7; } [data-icon=close]:before { background: url(//repo.bfw.wiki/bfwrepo/icon/5e03fe85c9e85.png); background-repeat: no-repeat; bottom: 0; background-position: center; content: ""; margin: auto; position: absolute; opacity: 0.4; right: 0; text-indent: 0; width: 35px; top: 0; } .example-header { margin-bottom: 35px; } .form-checkbox { float: left; font-size: 13px; font-weight: bold; margin-bottom: 20px; width: 50%; } .form-checkbox input[type=checkbox] { position: absolute; left: -9999px; } .form-checkbox input[type=checkbox] + label { cursor: pointer; display: inline-block; line-height: 27px; padding-left: 40px; position: relative; } .form-checkbox input[type=checkbox] + label:hover { color: #404040; } .form-checkbox input[type=checkbox] + label:hover:before { box-shadow: 0 0 8px rgba(0, 0, 0, 0.1); } .form-checkbox input[type=checkbox] + label:before { background-color: #fff; border: 1px solid #e6e6e6; border-radius: 2px; content: ""; cursor: pointer; display: block; position: absolute; left: 0; width: 25px; height: 25px; transition: all 0.2s ease-in-out; } #ex_1 { margin: 0 auto; width: 400px; } #ex_1 label { color: #999; } #ex_1 label + span { opacity: 0.5; } #ex_1 label + span input { cursor: not-allowed; } #ex_1 input[type=checkbox]:checked + label { color: #444; } #ex_1 input[type=checkbox]:checked + label + span { opacity: 1; } #ex_1 input[type=checkbox]:checked + label + span input { cursor: text; } #ex_1 input[type=checkbox]:checked + label:before { background-color: #1E76D7; border-color: #1b6ac1; border-radius: 2px; } #ex_1 input[type=checkbox]:checked + label:after { content: ""; background-image: url("//repo.bfw.wiki/bfwrepo/image/610ca5812f14a.png"); background-repeat: no-repeat; background-size: contain; top: 0; display: block; z-index: 55; position: absolute; left: 0; width: 15px; margin-top: 7px; margin-left: 6px; right: 0; height: 11px; } #ex_1 input[type=search] { border: 1px solid #e6e6e6; border-radius: 2px; font-size: 13px; margin-top: 15px; padding: 10px; width: 100%; box-shadow: none; } #ex_1 .example-footer { background-color: #fff; border-top: 1px solid #e6e6e6; border-radius: 0 0 5px 5px; margin: 15px -15px -15px; padding: 15px; } #ex_1 .example-footer .instruction { color: #888; font-size: 11px; font-weight: 300; line-height: 35px; } #ex_1 .example-container .example-footer input { border-radius: 2px; color: #fff; cursor: pointer; font-family: "Lato"; font-size: 13px; font-weight: bold; padding: 8px 16px; transition: all 0.2s ease-in-out; } #ex_1 .example-container .example-footer input.continue { background-color: #1E76D7; border: 1px solid #1b6ac1; } #ex_1 .example-container .example-footer input.reset { background-color: #eee; color: #666; border: 1px solid #cbcbcb; margin-right: 10px; } #ex_1 .example-container .example-footer input.reset:hover { background-color: #d0d0d0; } #ex_1 .example-container .example-footer input:hover, #ex_1 .example-container .example-footer input:active { background-color: #1b6ac1; } .percentage { background: transparent; border: 1px solid #ccc; color: #666; border-radius: 3px; font-size: 0.75rem; line-height: 1rem; width: 33px; padding: 0 5px; text-align: right; } .input-wrapper { position: relative; float: right; margin-right: 18px; margin-top: 5px; } .input-wrapper:after { color: #999; content: "%"; font-size: 0.75rem; margin-left: 3px; position: absolute; } .slider-container { cursor: pointer; float: right; margin-top: 5px; position: relative; width: 50%; } [disabled] { cursor: not-allowed !important; opacity: 0.5; } [disabled]:hover { background-color: #eee !important; } .noUi-horizontal .noUi-handle { cursor: pointer; } [disabled].noUi-connect .noUi-handle { cursor: not-allowed; } .example-wrapper:last-child { margin-bottom: 70px; } .container { height: 307px; margin: 0 auto; width: 400px; position: relative; perspective: 800px; } #card { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform 1s; } #card figure { display: block; position: absolute; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; } #card .front { transform: rotateY(0deg); -webkit-transform: rotateY(0deg); } #card .back { background-color: #1E76D7; border-radius: 2px; cursor: pointer; height: 289px; transform: rotateY(180deg); -webkit-transform: rotateY(180deg); } #card .back h2 { color: #fff; margin-bottom: 50px; margin-top: 50px; padding-bottom: 10px; font-weight: normal; } #card .back .description { color: #BBD5F3; font-size: 0.8rem; } #card .back .specifics { font-size: 1.2rem; margin: 10px 0 20px; color: #fff; } #card.flipped { transform: rotateY(180deg); -webkit-transform: rotateY(180deg); } /****** table *****/ .table { width: 400px; } .table-header { border-bottom: 2px solid #E0E4E9; display: table; margin-bottom: 5px; padding: 10px; width: 100%; } .descriptor { color: #888; display: inline-block; font-size: 11px; margin-right: 50px; text-transform: uppercase; } .descriptor:last-child { margin-right: 0; } .table-data > li { border-bottom: 1px solid #E0E4E9; cursor: pointer; list-style: none; margin-left: 75px; padding: 15px 10px; position: relative; } .table-data > li.selected { background-color: rgba(51, 55, 128, 0.04); } .table-data > li.selected:before { opacity: 1; } .table-data > li:hover, .table-data > li:active { background-color: rgba(51, 55, 128, 0.04); } .data-title { color: #262C39; font-size: 15px; margin-bottom: 5px; } .data-description { color: #777; font-size: 11px; margin-bottom: 3px; } .align-right .data-description { text-align: right; } [data-icon=mouse]:before { background-image: url(//repo.bfw.wiki/bfwrepo/icon/637e1f868f13e.png); top: 20px; } [data-icon=dog]:before { background-image: url(images/icon_dog.svg); top: 20px; } [data-icon=rabbit]:before { background-image: url(//repo.bfw.wiki/bfwrepo/image/5f4262460e0f0.png); top: 18px; } .table-data li:before { background-repeat: no-repeat; background-size: 75%; content: ""; height: 50px; left: -70px; opacity: 0.5; transition: all 0.2s ease-in-out; position: absolute; width: 50px; } /**** profile card ****/ .profile__card { position: relative; transition: all 0.2s ease-in-out; } .profile__card.minified .example-container:hover { cursor: pointer; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .profile__card.minified .example-container:hover .reveal-arrow:after { color: rgba(0, 0, 0, 0.5); } .profile__card .success { cursor: default; height: 100%; position: absolute; margin: auto; bottom: 0; top: 0; width: 100%; left: 0; background-color: rgba(255, 255, 255, 0.8); } .profile__card .success.show-success .success__message { top: 35%; } .profile__card .success__message { text-align: center; top: 25%; margin: 0 34px; position: relative; border-radius: 3px; color: #fff; padding: 20px 0; background: #333; transition: all 0.3s ease-in-out; } .profile__card .example-container { background-color: #fff; position: relative; transition: all 0.15s ease-in-out; } .profile__card .example-content { padding: 15px; transition: all 0.2s ease-in-out; } .profile__card ul { margin-top: 5px; } .profile__card li { color: #444444; font-size: 14px; list-style: none; padding: 20px 0; border-bottom: 1px solid #EBEBEB; } .profile__card .reveal-arrow:after { content: ""; font-family: "fontawesome"; font-size: 25px; margin: 0 auto; display: table; color: rgba(0, 0, 0, 0.3); margin-bottom: -10px; transition: all 0.2s ease-in-out; } .profile__card .example-header { background-image: url("//repo.bfw.wiki/bfwrepo/image/63834ab5a48ae.png"); background-position: top -60px center; border-radius: 2px 2px 0 0; margin: -15px -15px 0; position: relative; height: 60px; } .profile__card .example-header:before { background: url("//repo.bfw.wiki/bfwrepo/image/63834ab5a48ae.png"); border-radius: 100%; border: 4px solid #fff; content: ""; height: 50px; left: 0; right: 0; margin: 0 auto; position: absolute; transition: all 0.3s ease-in-out; top: 30px; width: 50px; background-size: 100%; } #ex_1 { position: relative; } #ex_1.plain:before { left: 0; opacity: 0; } #ex_1.plain:after { left: 0; opacity: 0; } #ex_1:before { content: ""; background-image: url("http://kellyharrop.com/images/pineapple.png"); height: 100%; width: 200px; display: block; background-repeat: no-repeat; position: absolute; left: -80px; opacity: 1; bottom: -74px; background-size: 70%; transition: opacity 0.3s ease-in-out, left 0.8s ease-in-out; } #ex_2 { margin-top: -90px; } .noUi-extended { background: #333780; } .card-action { padding: 20px; font-size: 14px; font-weight: 600; text-transform: uppercase; margin-top: 35px; } .card-action--submit { color: #1E76D7; } .card-action--submit:hover { .........完整代码请登录后点击上方下载按钮下载查看
网友评论0