mardi 8 septembre 2020

checkbox ripple effects with css

i am trying to implement the ripple effect for checkbox, but it is not showing exactly, the ripple effect width is getting too large , below is the code which i tried . i need a small width ripple effect with light background, i think i missed some styles. can any one please help me regarding this issue , Thanks in advance

.checkbox label {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  padding-left: 5px;
}

.checkbox label::before {
  content: "";
  display: inline-block;
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 0px;
  margin-left: -20px;
  border: 1px solid #ccc;
  border-radius: 2px;
  background-color: #fff;
  -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
  -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
  transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
}

.checkbox label::after {
  display: inline-block;
  position: absolute;
  width: 16px;
  height: 16px;
  left: 1px;
  top: 1px;
  font-weight: 100;
  margin-left: -18px;
  padding-left: 3px;
  padding-top: 1px;
  font-size: 11px;
  color: #555;
}

.cbox-table label::after,
.cbox-table label::before {
  margin-left: 0px;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  opacity: 0;
  z-index: 1;
  cursor: pointer;
}

.checkbox input[type="checkbox"]:indeterminate + label::after,
.checkbox input[type="radio"]:indeterminate + label::after {
  display: block;
  content: "";
  width: 10px;
  height: 3px;
  background-color: #555;
  border-radius: 2px;
  margin-left: -16.5px;
  margin-top: 7px;
}

.checkbox input[type="checkbox"]:disabled + label,
.checkbox input[type="radio"]:disabled + label {
  opacity: 0.65;
}

.checkbox input[type="checkbox"]:disabled + label::before,
.checkbox input[type="radio"]:disabled + label::before {
  background-color: #eee;
  cursor: not-allowed;
}

.checkbox.checkbox-circle label::before {
  border-radius: 50%;
}

.checkbox.checkbox-inline {
  margin-top: 0;
}

.checkbox-warning input[type="checkbox"]:checked + label::before,
.checkbox-warning input[type="radio"]:checked + label::before {
  background-color: #007bff;
  border-color: #007bff;
}

.checkbox-warning input[type="checkbox"]:checked + label::after,
.checkbox-warning input[type="radio"]:checked + label::after {
  color: #fff;
}

.checkbox-warning input[type="checkbox"]:indeterminate + label::before,
.checkbox-warning input[type="radio"]:indeterminate + label::before {
  background-color: #007bff;
  border-color: #007bff;
}

.checkbox-warning input[type="checkbox"]:indeterminate + label::after,
.checkbox-warning input[type="radio"]:indeterminate + label::after {
  background-color: #fff;
}

.checkbox input[type="checkbox"]:checked + label::after {
  font-family: "FontAwesome";
  content: "\f00c";
}


input[type="checkbox"]:focus+label::before {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 1;
  }
  20% {
    transform: scale(25, 25);
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(40, 40);
  }
}
<div class="form-check form-check-inline checkbox checkbox-warning checkbox-inline pl-0 text-left">
            <input class="form-check-input" type="checkbox" id="check1" name="enquiry" >
            <label class="form-check-label label-font" for="inlineCheckbox1">Approved Leaves</label>
        </div>



Aucun commentaire:

Enregistrer un commentaire