<div class="flex_container">
<div class="current_items">
<div class="current_items__row">
<div class="wrapper_input">
<input type="radio" name="one" id="radio1" checked="checked">
<label for="radio1">first radio</label>
</div>
<div class="wrapper_input">
<input type="radio" name="one" id="radio2">
<label for="radio2">first radio</label>
</div>
</div>
<div class="current_items__row">
<div class="wrapper_input">
<input type="radio" name="two" id="radio3">
<label for="radio3">second radio</label>
</div>
<div class="wrapper_input">
<input type="radio" name="two" id="radio4">
<label for="radio4">second radio</label>
</div>
</div>
</div>
</div>
body {
height: 100%;
padding: 0;
display: block;
margin: 0;
background: #202344;
}
.flex_container {
display: flex;
flex-flow: row wrap;
height: 100vh;
}
.current_items {
width: 100%;
margin: auto;
transition: .4s;
display: flex;
flex-flow: row wrap;
align-items: center;
justify-content: center;
&__row {
border: 3px solid rgba(255, 255, 255, .2);
padding: 4vh 1vw;
width: 400px;
text-align: center;
max-width: 46%;
margin: 0 1%;
}
.wrapper_input {
position: relative;
margin: 20px 0;
}
input {
display: none;
&:checked {
& + label {
&:after {
transform: scale(1);
opacity: 1;
}
}
}
}
label {
font: 20px Helvetica;
font-weight: 300;
letter-spacing: 3px;
color: rgba(255, 255, 255, .8);
margin: 0;
padding-left: 35px;
display: inline-block;
position: relative;
&:before {
width: 20px;
height: 20px;
content: '';
position: absolute;
left: 0;
top: 50%;
background: #fff;
margin-top: -10px;
}
&:after {
background: #f33232;
left: 0;
top: 50%;
transition: .3s;
transform: scale(3.4);
opacity: 0;
margin-top: -7px;
width: 14px;
height: 14px;
content: '';
position: absolute;
left: 3px;
}
}
}
View Compiled
$(document).ready(function() {
$("label").on("click", function(e) {
e.preventDefault();
var $radio = $("#" + $(this).attr("for")),
name = $radio.attr("name"),
hasRadio = $radio.attr("type") == "radio";
if (!hasRadio) return;
if ($radio.data("is-checked") == true) {
$radio.prop("checked", false).change();
$radio.data("is-checked", false);
} else {
$radio.data("is-checked", true);
$radio.prop("checked", true).change();
}
$('input[type="radio"][name="' + name + '"]')
.not("#" + $(this).attr("for"))
.data("is-checked", false);
});
});