本文介绍了分享一个H5原生form表单的checkbox特效代码,分享给大家,具体如下:
效果如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .md-checkbox { margin: 50px; position: relative; height: auto; font-size: 14px; } .md-checkbox label>span.inc { -webkit-animation: growCircle 0.2s ease; -moz-animation: growCircle 0.2s ease; animation: growCircle 0.2s ease; } @keyframes growCircle { 0%, 100% { transform: scale(0); opacity: 0.8; } 70% { background: #eee; transform: scale(1.25); } } .md-checkbox label>span.inc { background: #fff; left: -20px; top: -20px; height: 60px; width: 60px; opacity: 0; border-radius: 50% !important; -moz-border-radius: 50% !important; -webkit-border-radius: 50% !important; } .md-checkbox input[type=checkbox] { visibility: hidden; position: absolute; } .md-checkbox label { cursor: pointer; padding-left: 30px; } .md-checkbox label>span { display: block; position: absolute; left: 0; -webkit-transition-duration: 0.2s; -moz-transition-duration: 0.2s; transition-duration: 0.2s; } .md-checkbox label>.check { top: -4px; left: 6px; width: 10px; height: 20px; border: 2px solid #26A69A; border-top: none; border-left: none; opacity: 0; z-index: 5; -webkit-transform: rotate(180deg); -moz-transform: rotate(180deg); transform: rotate(180deg); -webkit-transition-delay: 0.2s; -moz-transition-delay: 0.2s; transition-delay: 0.2s; } .md-checkbox input[type=checkbox]:checked~label>.check { opacity: 1; -webkit-transform: scale(1) rotate(45deg); -moz-transform: scale(1) rotate(45deg); transform: scale(1) rotate(45deg); } .md-checkbox input[type=checkbox]:checked~label>.box { opacity: 0; -webkit-transform: scale(0) rotate(-180deg); -moz-transform: scale(0) rotate(-180deg); transform: scale(0) rotate(-180deg); } .md-checkbox label>.box { top: 0px; border: 2px solid #666; height: 20px; width: 20px; z-index: 5; -webkit-transition-delay: 0.2s; -moz-transition-delay: 0.2s; transition-delay: 0.2s; } </style> </head> <body> <div class="md-checkbox"> <input type="checkbox" id="test" class="md-check" /> <label for="test"> <span></span> <span class="check"></span> <span class="box"></span> Option 1 </label> </div> <script> var list = document.getElementsByTagName('input'); for(var i =0;i<list.length;i++){ (function(n){ list[n].addEventListener('click',function(e){ var inc = this.nextElementSibling.firstElementChild; inc.className = ''; setTimeout(function(){ inc.className = 'inc'; },0); }) })(i) } </script> </body> </html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
你好呀,我是歪歪。 比如下面这位读者: 他是看了我 《神了!异常信息突然就没了...
本文学习的内容主要如下所示: 1.关闭按钮 2.Carets 3.快速设置浮动 4.内容区域...
styled components 一种全新的控制样式的编程方式,它能解决 CSS 全局作用域的问...
当你开始做一个项目的时候,用线框图把你的想法勾勒出来非常重要。这是你把想法...
项目地址: https://github.com/Wscats/CV 简历的本质 在写简历之前,我们必须清...
先来看看静态的效果图 实例代码 复制代码 代码如下: !DOCTYPE html html head me...
简介: 数禾通过构建自身的数据中台,打通以往独立建设的IT系统,使得各方数据汇...
导 读 3月1日出版发行的2020年第5期《求是》杂志,刊发了中共工业和信息化部党组...
本文学习的内容主要如下所示: 1.浏览器支持 2.图片 3.响应式工具 4.遇到的问题 ...
TOP云 (west.cn)10月24日消息,dnjournal今天发布新一期的DN 域名交易 榜(10...