Slidr.css experimental

A standalone CSS library for sliding checkboxes.
No Javascript needed!

Download .zip Download .tar.gz View on GitHub


Sample Code

<label class="checkbox">
  <!--
    Note the data-on and data-off attributes to set text for the states.
    Possible additional classes (alla Bootstrap) are:
      * slidr-info
      * slidr-success
      * slidr-warning
      * slidr-danger
      * slidr-inverse
  -->
  <input type="checkbox">
  <span class="slidr" data-on="ON" data-off="OFF"></span>
  Option one is this and that—be sure to include why it's great
</label>

Demo

Internet Explorer

First off let me say that this piece of css is not meant for production use. Second I didn't create this with IE in mind.

However, loads of comments have been made regarding IE so here it goes:

Internet Explorer vs. Firefox

Styles

slidr.css was built on top of Twitter Bootstrap, therefor I added the default styles which are used for labels, badges, buttons and so on.

  • .slidr-info
  • .slidr-success
  • .slidr-warning
  • .slidr-danger
  • .slidr-inverse

Transitions

Currently transitions on pseudo elements is only available in Firefox and Internet Explorer 10. But in case the Chrome update becomes available in the next few weeks I added transitions for all browsers

Get Started

  1. Download the source, the combined or minified version from GitHub:
  2. Include them as stylesheets in your page.
  3. Create a checkbox with the new slidr class:

    <label class="checkbox">
      <input type="checkbox">
      <span class="slidr"></span>
      Option one is this and that—be sure to include why it's great
    </label>
    
  4. If you need a green slider use slidr-success:

    <label class="checkbox">
      <input type="checkbox">
      <span class="slidr slidr-success"></span>
      Option one is this and that—be sure to include why it's great
    </label>
    

That's it now get cracking ...

Issues & Contribution

Please refer to the issues section of this repository if you stumble upon any bugs or possible bugs. But keep in mind to search for a similar issue before posting.

If you want to contribute you know the drill: fork - change - open pull request

License (MIT)

Copyright (c) 2013 Thomas Stachl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.