1

I found this cool style here on stackoverflow link but I didn't know how to apply it to the chekcbox from angular-ui, well they're labels.

I tried adding them as classes, the effect has changed but the active class keep on messing up everything, and they looked weird.

1
  • can you post your code here...I mean what exactly have you tried so far. Commented Jun 2, 2015 at 19:00

1 Answer 1

1

Here is the working plunkr...http://plnkr.co/edit/6CFc73JZTWujUQWnTrWr?p=preview

Basically just add this CSS,

.btn-primary {
  background: url('http://lorempixel.com/output/people-q-c-50-50-1.jpg') no-repeat;
  height: 50px;
  width: 50px;
  display: block;
  border-radius: 50%;
  position: relative;
  transition: all 0.4s;
  border: solid 5px #FFF;
  box-shadow: 0 0 1px #FFF; /* Soften the jagged edge */
}
/* Provide a border when hovered and when the checkbox before it is checked */
.btn-primary:hover,
.btn-primary.active,
.btn-primary:focus{
  border: solid 5px #F00;
  box-shadow: 0 0 1px #F00; /* Soften the jagged edge */
}
/* 
- Create a pseudo element :after when checked and provide a tick
- Center the content
*/
.btn-primary.active::after {
  content: '\2714'; /*content is required, though it can be empty - content: '';*/
  display: block;
  height: 1.5em;
  width: 1em;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  color: #F00;
}
.btn-primary.active{
  background: url('http://lorempixel.com/output/people-q-c-50-50-1.jpg') no-repeat;
}

whereas in HTML,

<button type="button" class="btn btn-primary" ng-model="singleModel" btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0"></button>
Sign up to request clarification or add additional context in comments.

3 Comments

but now all "btn-primary" all looks like that, is there a wat to change that ?
just add a class to your button for example my-custom-btn ` and it will look like <button type="button" class="btn btn-primary my-custom-btn" ng-model="singleModel" btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0"></button> now just replace all the btn-primary in the above CSS with the class my-custom-btn
Thanks for the reply, but I managed to get it working and replaced most of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.