So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By dean95
#63002 Hi to everybody,
I'm new to this forum and Esp8266 World.
I'm designing a html page for Web Server project.
I can't use a toggle switch outputing a "0" value in "before state" and "1" value in "after state".

CSS PART:

.onoffswitch {
position: relative; width: 60px;
-webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;
}
.onoffswitch-checkbox {
display: none;
}
.onoffswitch-label {
display: block; overflow: hidden; cursor: pointer;
height: 36px; padding: 0; line-height: 36px;
border: 2px solid #E3E3E3; border-radius: 36px;
background-color: #FFFFFF;
transition: background-color 0.3s ease-in;
}
.onoffswitch-label:before {
content: "";
display: block; width: 36px; margin: 0px;
background: #FFFFFF;
position: absolute; top: 0; bottom: 0;
right: 22px;
border: 2px solid #E3E3E3; border-radius: 36px;
transition: all 0.3s ease-in 0s;
}
.onoffswitch-checkbox:checked + .onoffswitch-label {
background-color: #49E845;
}
.onoffswitch-checkbox:checked + .onoffswitch-label, .onoffswitch-checkbox:checked + .onoffswitch-label:before {
border-color: #49E845;
}
.onoffswitch-checkbox:checked + .onoffswitch-label:before {
right: 0px;
}

HTML PART :

<div class="onoffswitch">
<input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch">
<label class="onoffswitch-label" for="myonoffswitch"></label>
</div>

someone could help me,please? thanks a lot.
User avatar
By dean95
#63128 thanks for the answer, i want to do this:

by default the toggle is in before while if i press the toggle is in after state.

At this point:

in BEFORE STATE,corresponding value must be 0
while
in AFTER STATE,corresponding value must be 1

these values are fundamental for doing a function..

if not clear,can explain better..
You do not have the required permissions to view the files attached to this post.