Switch Button more intuitive
-
Hi @fclaussen,
I propose this basis code to customize switch button with dashicons-controls-play and dashicons-controls-pause included, what do you think?
Red when OFF, green when ON.
CSS:
.onoffswitch { position: relative; width: 65px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch-checkbox { display: none; } .onoffswitch-label { display: block; overflow: hidden; cursor: pointer; border: 2px solid #FBFBFB; border-radius: 20px; } .onoffswitch-inner { display: block; width: 200%; margin-left: -100%; transition: margin 0.3s ease-in 0s; } .onoffswitch-inner:before, .onoffswitch-inner:after { display: block; float: left; width: 50%; height: 28px; padding: 0; line-height: 28px; font-size: 34px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; box-sizing: border-box; } .onoffswitch-inner:before { font-family: 'dashicons'; content: "\f523"; padding-left: 10px; background-color: #4DDB0B; color: #FBFBFB; } .onoffswitch-inner:after { font-family: 'dashicons'; content: "\f522"; padding-right: 10px; background-color: #FB1B1B; color: #FBFBFB; text-align: right; } .onoffswitch-switch { display: block; width: 18px; margin: 5px; background: #FBFBFB; position: absolute; top: 0; bottom: 0; right: 33px; border: 2px solid #FBFBFB; border-radius: 20px; transition: all 0.3s ease-in 0s; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { margin-left: 0; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { right: 0px; }
HTML:
<div class="onoffswitch"> <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" checked> <label class="onoffswitch-label" for="myonoffswitch"> <span class="onoffswitch-inner"></span> <span class="onoffswitch-switch"></span> </label> </div>
I also propose to replace the blue color of the plugin by a more neutral color because the blue is not necessarily appropriate with the colors of all sites.
Regards
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Switch Button more intuitive’ is closed to new replies.