startv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

            
              !!!
%html
  %head
    %meta{ :charset => "utf-8" }
    %title "iOS7 Toggle"
    %script{ :src => "//code.jquery.com/jquery-latest.min.js" }
  %body
    .toggle-wrap
      .toggle
        .toggle-color
        .toggle-dot

    .copyright
      Created by
      %a{ :href => "http://twitter.com/iDuuck" } Dominik Schmidt
      ·
      Inspired by
      %a{ :href => "http://twitter.com/iDuuck" } Daniel Eden
            
          
!

CSS

            
              @import compass

*
  box-sizing: border-box
  font: 13px/24px "Helvetica Neue", sans-serif

.toggle-wrap
  position: absolute
  top: 50%
  left: 50%
  margin-top: -16px
  margin-left: -35px

  .toggle
    position: relative
    background: #e1e1e1
    padding: 2px
    width: 70px
    box-shadow: inset 0px 0px 0px 2px darken(#e1e1e1, 2)
    height: 32px
    border-radius: 16px

    transition: all .4s ease-in-out

    &.active
      box-shadow: inset 0px 0px 0px 30px #57de72

      &:active
        .toggle-dot
          margin-left: 30px

      .toggle-dot
        margin-left: 38px


    &:active
      // box-shadow: inset 0px 0px 0px 30px #57de72

      .toggle-dot
        width: 36px

    .toggle-dot
      position: relative
      z-index: 3
      background: white
      height: 28px
      width: 28px
      border-radius: 14px
      transition: all .2s ease-in-out

.copyright
  position: absolute
  left: 10%
  right: 10%
  text-align: center
  color: #999
  bottom: 15px
  font-size: 13px

  a
    color: inherit
            
          
!

JS

            
              $ ->
  $('.toggle').mouseup ->
    $(@).toggleClass 'active'
    return
  return
            
          
!
999px
Loading ..................

Console