Skip to content

Instantly share code, notes, and snippets.

@hmbashar
Last active September 12, 2022 00:10
Show Gist options
  • Save hmbashar/7d5a2a896376b2c05282dccaf6da6232 to your computer and use it in GitHub Desktop.
Save hmbashar/7d5a2a896376b2c05282dccaf6da6232 to your computer and use it in GitHub Desktop.
Start sign for gravity from radio button
/*
You must need to call Font awesome CSS for load icon
*/
.ginput_container.ginput_container_radio .gfield_radio {display: flex;}
.ginput_container.ginput_container_radio .gfield_radio .gchoice label{cursor:pointer;}
.ginput_container.ginput_container_radio .legend_selected_stars.gchoice label:before{color:#316A85 !important;}
.ginput_container.ginput_container_radio .gchoice input {
display:none;
cursor: pointer;
}
.ginput_container.ginput_container_radio .gchoice input[type='radio'] + label:before {
font-family: "Font Awesome 5 free";
font-size: 25px !important;
margin-right: 6px;
}
.ginput_container.ginput_container_radio .gchoice input[type=radio] + label:before {
content: "\f005";
font-weight:300 ;
color:#ccd6df;
/* Radio Unchecked */
}
.ginput_container.ginput_container_radio .gchoice input[type=radio]:checked + label:before {
content: "\f005";
font-weight:400 ;
color:#316A85 ;
/* Radio Checked */
}
<script>
// add extra class for seleted/checked star icon css
jQuery('.ginput_container.ginput_container_radio').children('.gchoice').on('click', function(){
jQuery(this).addClass('legend_selected_stars');
jQuery(this).prevAll('.gchoice').addClass('legend_selected_stars');
jQuery(this).nextAll('.gchoice').removeClass('legend_selected_stars');
});
//remove text from label
jQuery('.ginput_container.ginput_container_radio .gfield_radio .gchoice').addClass('legend_selected_stars').children('label').empty();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment