checkbox效果

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>选中标签forcheck</title>
<script src="./js/jquery-2.1.1.min.js"></script>
<style type="text/css">
.riskSources label {
cursor: pointer;
position: relative;
display: inline-block;
width: 49px;
height:49px;
border: 1px solid transparent;
}
/**
* 按钮透明
* @type {String}
*/
#riskCheck {
opacity: 0;
}
/**
* checkbox选中样式
* @type {String}
*/
#riskCheck:checked + i {
border-color: blue;
color: blue;
border-width:2px;
}
/**
* i标签的大小
*/
.riskSources i {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 1px solid transparent;
text-align: center;
line-height: 36px;
border-radius: 50%;
margin-left:-3px;
margin-top:-3px;
}

/**
* 选中状态,span(三角形)样式
* @type {String}
*/
#riskCheck:checked + i + span {
display: inline-block;
    position: relative;
    width: 15px;
    padding-top: -80px;
    height: 15px;
    float: right;
    margin-top: 14px;
	margin-right: -5px;
    border-radius: 50%;
    background-color: blue;
	border-width:2px;
}
#riskCheck:checked  +i+ span:before,
#riskCheck:checked +i + span:after {content: '';pointer-events: none;position: absolute;color: white;border: 1px solid;background-color: white;}
#riskCheck:checked + i + span:before {width: 1px;height: 1px;left: 25%;top: 50%;transform: skew(0deg,50deg);}
#riskCheck:checked + i + span:after{width: 3px;height: 1px;left: 45%;top: 42%;transform: skew(0deg,-50deg);}
</style>
<script >
function test(){
	alert($('#riskCheck').is(':checked'));
}
</script>
</head>
<body>
<div class="riskSources" style="
    background: url(./ziyuan3.png) no-repeat;
    border-radius:34px;
    height: 51px;
    width:51px;
    background-size: 100% 100%;
    ">
<label>
<input id="riskCheck" type="checkbox" value="cbEticket" style="  
    background-size: 100% 100%;
    border: 2px solid blue;
    width: 100%;
    ">
	<i></i>
<span></span>
</label>
</div>
<button onclick="test()">测试吧</button>
</body>
</html>

未选中效果:

点击后效果:

图片源:

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值