Browse Source

Added the growing toggle. Transform is now borked.

pull/216/merge
connors 11 years ago
parent
commit
151f263023
  1. 20
      dist/ratchet.css
  2. 17
      lib/sass/toggles.scss

20
dist/ratchet.css vendored

@ -1016,8 +1016,8 @@ input[type="button"] {
box-shadow: inset 0 0 0 0 #e1e1e1; box-shadow: inset 0 0 0 0 #e1e1e1;
-webkit-transition-property: box-shadow, border; -webkit-transition-property: box-shadow, border;
transition-property: box-shadow, border; transition-property: box-shadow, border;
-webkit-transition-duration: 0.2s; -webkit-transition-duration: 0.4s;
transition-duration: 0.2s; transition-duration: 0.4s;
} }
.toggle .toggle-handle { .toggle .toggle-handle {
position: absolute; position: absolute;
@ -1027,17 +1027,20 @@ input[type="button"] {
width: 28px; width: 28px;
height: 28px; height: 28px;
background-color: #fff; background-color: #fff;
border: 1px solid rgba(0, 0, 0, 0.1); border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 100px; border-radius: 100px;
-webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.08); -webkit-box-shadow: 0 3px 3px rgba(0, 0, 0, 0.08);
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.08); box-shadow: 0 3px 3px rgba(0, 0, 0, 0.08);
-webkit-transition-property: -webkit-transform, border, width; -webkit-transition-property: -webkit-transform, border, width, margin;
transition-property: -webkit-transform, border, width; transition-property: -webkit-transform, border, width, margin;
-webkit-transition-duration: 0.2s; -webkit-transition-duration: 0.1s;
transition-duration: 0.2s; transition-duration: 0.1s;
-webkit-transition-timing-function: ease-in-out; -webkit-transition-timing-function: ease-in-out;
transition-timing-function: ease-in-out; transition-timing-function: ease-in-out;
} }
.toggle:active .toggle-handle {
width: 35px;
}
.toggle.active { .toggle.active {
border: 2px solid #4cd964; border: 2px solid #4cd964;
-webkit-box-shadow: inset 0 0 0 30px #4cd964; -webkit-box-shadow: inset 0 0 0 30px #4cd964;
@ -1048,6 +1051,9 @@ input[type="button"] {
-webkit-transform: translate3d(17px, 0, 0); -webkit-transform: translate3d(17px, 0, 0);
transform: translate3d(17px, 0, 0); transform: translate3d(17px, 0, 0);
} }
.toggle.active .toggle-handle:active {
margin-left: -7px;
}
.content.fade { .content.fade {
left: 0; left: 0;

17
lib/sass/toggles.scss

@ -11,7 +11,7 @@
border-radius: 20px; border-radius: 20px;
@include box-shadow(inset 0 0 0 0 #e1e1e1); @include box-shadow(inset 0 0 0 0 #e1e1e1);
@include transition-property(box-shadow, border); @include transition-property(box-shadow, border);
@include transition-duration(.2s); @include transition-duration(.4s);
// Sliding handle // Sliding handle
.toggle-handle { .toggle-handle {
@ -22,17 +22,20 @@
width: 28px; width: 28px;
height: 28px; height: 28px;
background-color: #fff; background-color: #fff;
border: 1px solid rgba(0, 0, 0, .1); border: 1px solid rgba(0, 0, 0, .2);
border-radius: 100px; border-radius: 100px;
@include box-shadow(0 3px 3px rgba(0,0,0,.08)); @include box-shadow(0 3px 3px rgba(0,0,0,.08));
@include transition-property(-webkit-transform, border, width); @include transition-property(-webkit-transform, border, width, margin);
@include transition-duration(.2s); @include transition-duration(.1s);
@include transition-timing-function(ease-in-out); @include transition-timing-function(ease-in-out);
} }
&:active .toggle-handle {
width: 35px;
}
// Active state for toggle // Active state for toggle
&.active { &.active {
//background-color: $positive-color;
border: 2px solid $positive-color; border: 2px solid $positive-color;
@include box-shadow(inset 0 0 0 30px $positive-color); @include box-shadow(inset 0 0 0 30px $positive-color);
} }
@ -41,5 +44,9 @@
&.active .toggle-handle { &.active .toggle-handle {
border-color: $positive-color; border-color: $positive-color;
@include transform(translate3d(17px,0,0)); @include transform(translate3d(17px,0,0));
&:active {
margin-left: -7px;
}
} }
} }
Loading…
Cancel
Save