Hi guys,
I would like to obtain a iOS checkbox effect.
Basically I did it with css:
and custom code:
But I don't manage to make it work with a chronoform checkbox.
I try to put "ios8-switch ios8-switch-lg" in the style field of the checkbox, but there is no result.
Same as if I go to code and I force the class.
Any idea?
Thanks
I would like to obtain a iOS checkbox effect.
Basically I did it with css:
input[type="checkbox"].ios8-switch {
position: absolute;
margin: 8px 0 0 16px;
}
input[type="checkbox"].ios8-switch + label {
position: relative;
padding: 5px 0 0 50px;
line-height: 2.0em;
}
input[type="checkbox"].ios8-switch + label:before {
content: "";
position: absolute;
display: block;
left: 0;
top: 0;
width: 40px; /* x*5 */
height: 24px; /* x*3 */
border-radius: 16px; /* x*2 */
background: #fff;
border: 1px solid #d9d9d9;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
input[type="checkbox"].ios8-switch + label:after {
content: "";
position: absolute;
display: block;
left: 0px;
top: 0px;
width: 24px; /* x*3 */
height: 24px; /* x*3 */
border-radius: 16px; /* x*2 */
background: #fff;
border: 1px solid #d9d9d9;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
input[type="checkbox"].ios8-switch + label:hover:after {
box-shadow: 0 0 5px rgba(0,0,0,0.3);
}
input[type="checkbox"].ios8-switch:checked + label:after {
margin-left: 16px;
}
input[type="checkbox"].ios8-switch:checked + label:before {
background: #55D069;
}
/* SMALL */
input[type="checkbox"].ios8-switch-sm {
margin: 5px 0 0 10px;
}
input[type="checkbox"].ios8-switch-sm + label {
position: relative;
padding: 0 0 0 32px;
line-height: 1.3em;
}
input[type="checkbox"].ios8-switch-sm + label:before {
width: 25px; /* x*5 */
height: 15px; /* x*3 */
border-radius: 10px; /* x*2 */
}
input[type="checkbox"].ios8-switch-sm + label:after {
width: 15px; /* x*3 */
height: 15px; /* x*3 */
border-radius: 10px; /* x*2 */
}
input[type="checkbox"].ios8-switch-sm + label:hover:after {
box-shadow: 0 0 3px rgba(0,0,0,0.3);
}
input[type="checkbox"].ios8-switch-sm:checked + label:after {
margin-left: 10px; /* x*2 */
}
/* LARGE */
input[type="checkbox"].ios8-switch-lg {
margin: 10px 0 0 20px;
}
input[type="checkbox"].ios8-switch-lg + label {
position: relative;
padding: 7px 0 0 60px;
line-height: 2.3em;
}
input[type="checkbox"].ios8-switch-lg + label:before {
width: 50px; /* x*5 */
height: 30px; /* x*3 */
border-radius: 20px; /* x*2 */
}
input[type="checkbox"].ios8-switch-lg + label:after {
width: 30px; /* x*3 */
height: 30px; /* x*3 */
border-radius: 20px; /* x*2 */
}
input[type="checkbox"].ios8-switch-lg + label:hover:after {
box-shadow: 0 0 8px rgba(0,0,0,0.3);
}
input[type="checkbox"].ios8-switch-lg:checked + label:after {
margin-left: 20px; /* x*2 */
}
and custom code:
<input type='checkbox' class='ios8-switch ios8-switch-lg' id='checkbox-3'>
<label for='checkbox-3'>iOS8 switch (large)</label>
But I don't manage to make it work with a chronoform checkbox.
I try to put "ios8-switch ios8-switch-lg" in the style field of the checkbox, but there is no result.
Same as if I go to code and I force the class.
Any idea?
Thanks
Hi vismay,
It works OK if I put ios8-switch ios8-switch-lg in the Class box of a CheckBox Group element.
Bob
It works OK if I put ios8-switch ios8-switch-lg in the Class box of a CheckBox Group element.
Bob
Yes, it works..but not the single checkbox, that actually is the only on/off button...
Hi Vismay,
It works OK with a single checkbox too. I'm not clear what exactly you need to do?
Bob
It works OK with a single checkbox too. I'm not clear what exactly you need to do?
Bob
Got it!
I was using a custom checkbox input to test it, and probably it was "stealing" the class...
😈
Thanks
I was using a custom checkbox input to test it, and probably it was "stealing" the class...
😈
Thanks
nops, if I put it in a multi field with enable / disable events doesn't work.
😟
😟
Sorry, I was just testing. Looks like the css doesn't work if there is no text in sub label.
So I've written just some text in the sub label field (something like yes/no)
So I've written just some text in the sub label field (something like yes/no)
This topic is locked and no more replies can be posted.